Skip to content

Commit e07c7e2

Browse files
authored
Merge pull request #2731 from benrimmington/se-0465
[SE-0465] Rename `Vector`, add syntax highlighting
2 parents 665ea76 + a39c5fa commit e07c7e2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

proposals/0465-nonescapable-stdlib-primitives.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ The object identifier of a noncopyable/nonescapable type is still a regular copy
357357

358358
[SE-0437] omitted generalizing the `Equatable` conformance of `ManagedBufferPointer`; this proposal allows comparing `ManagedBufferPointer` instances for equality even if their `Element` happens to be noncopyable.
359359

360-
[SE-0437] kept the `indices` property of unsafe buffer pointer types limited to cases where `Element` is copyable. This proposal generalizes `indices` to be also available on buffer pointers of noncopyable elements. (In the time since the original proposal, [SE-0447] has introduced a `Span` type that ships with an unconditional `indices` property, and [SE-0453] followed suit by introducing `Vector` with the same property. It makes sense to also provide this interface on buffer pointers, for consistency.) `indices` is useful for iterating through these collection types, especially until we ship a new iteration model that supports noncopyable/nonescapable containers.
360+
[SE-0437] kept the `indices` property of unsafe buffer pointer types limited to cases where `Element` is copyable. This proposal generalizes `indices` to be also available on buffer pointers of noncopyable elements. (In the time since the original proposal, [SE-0447] has introduced a `Span` type that ships with an unconditional `indices` property, and [SE-0453] followed suit by introducing `InlineArray` with the same property. It makes sense to also provide this interface on buffer pointers, for consistency.) `indices` is useful for iterating through these collection types, especially until we ship a new iteration model that supports noncopyable/nonescapable containers.
361361

362362
Finally, [SE-0437] neglected to generalize any of the buffer pointer operations that [SE-0370] introduced on the standard `Slice` type. In this proposal, we correct this omission by generalizing the handful of operations that can support noncopyable result elements: `moveInitializeMemory(as:fromContentsOf:)`, `bindMemory(to:)`, `withMemoryRebound(to:_:)`, and `assumingMemoryBound(to:)`. `Slice` itself continues to require its `Element` to be copyable (at least for now), preventing the generalization of other operations.
363363

@@ -481,7 +481,7 @@ As noted above, we defer generalizing the nil-coalescing operator `??`. We expec
481481

482482
The Standard Library provides special support for comparing arbitrary optional values against `nil`. We generalize this mechanism to support nonescapable cases:
483483

484-
```
484+
```swift
485485
extension Optional where Wrapped: ~Copyable & ~Escapable {
486486
static func ~=(
487487
lhs: _OptionalNilComparisonType,
@@ -547,7 +547,7 @@ Both of these functions return a value with the same lifetime as the original `R
547547

548548
We can also generalize the convenient `get()` function, which is roughly equivalent to optional unwrapping:
549549

550-
```
550+
```swift
551551
extension Result where Success: ~Copyable & ~Escapable {
552552
@_lifetime(copying self) // Illustrative syntax
553553
consuming func get() throws(Failure) -> Success
@@ -670,7 +670,7 @@ Managed buffer pointers are pointer types -- as such, they can be compared wheth
670670

671671
### Making `indices` universally available on unsafe buffer pointers
672672

673-
[SE-0437] kept the `indices` property of unsafe buffer pointer types limited to cases where `Element` is copyable. In the time since that proposal, [SE-0447] has introduced a `Span` type that ships with an unconditional `indices` property, and [SE-0453] followed suit by introducing `Vector` with the same property. For consistency, it makes sense to also allow developers to unconditionally access `Unsafe[Mutable]BufferPointer.indices`, whether or not `Element` is copyable.
673+
[SE-0437] kept the `indices` property of unsafe buffer pointer types limited to cases where `Element` is copyable. In the time since that proposal, [SE-0447] has introduced a `Span` type that ships with an unconditional `indices` property, and [SE-0453] followed suit by introducing `InlineArray` with the same property. For consistency, it makes sense to also allow developers to unconditionally access `Unsafe[Mutable]BufferPointer.indices`, whether or not `Element` is copyable.
674674

675675
```swift
676676
extension UnsafeBufferPointer where Element: ~Copyable {

0 commit comments

Comments
 (0)