Add subscript requirements to [Mutable]Container with borrow/mutate accessors

This commit is contained in:
Karoy Lorentey committed 2026-06-22 20:10:22 -07:00
1 parent 22a94a9756
commit e8b09ade25
11 files changed
+59 -41

No files matched your search

@@ -114,12 +114,13 @@ extension UniqueArray where Element: ~Copyable {
@inlinable
public subscript(position: Int) -> Element {
@inline(__always)
unsafeAddress {
_storage._ptr(to: position)
borrow {
_storage[position]
}
@inline(__always)
unsafeMutableAddress {
_storage._mutablePtr(to: position)
@_unsafeSelfDependentResult // FIXME: Why is this necessary?
mutate {
&_storage[position]
}
}
}