@@ -49,7 +49,7 @@ internal func _overrideLifetime<
49
49
/// the `source` argument.
50
50
@_unsafeNonescapableResult
51
51
@_transparent
52
- @lifetime ( borrow source)
52
+ @lifetime ( & source)
53
53
internal func _overrideLifetime<
54
54
T: ~ Copyable & ~ Escapable, U: ~ Copyable & ~ Escapable
55
55
> (
@@ -110,7 +110,7 @@ struct MutableSpan<T>: ~Escapable, ~Copyable {
110
110
let base : UnsafeMutablePointer < T >
111
111
let count : Int
112
112
113
- @lifetime ( borrow base)
113
+ @lifetime ( & base)
114
114
init ( base: UnsafeMutablePointer < T > , count: Int ) {
115
115
self . base = base
116
116
self . count = count
@@ -128,7 +128,7 @@ extension Array {
128
128
}
129
129
130
130
extension Array {
131
- @lifetime ( borrow self)
131
+ @lifetime ( & self )
132
132
mutating func mutableSpan( ) -> MutableSpan < Element > {
133
133
/* not the real implementation */
134
134
let p = self . withUnsafeMutableBufferPointer { $0. baseAddress! }
@@ -263,7 +263,7 @@ struct MutableView: ~Escapable, ~Copyable {
263
263
self . owner = copy owner // OK
264
264
}
265
265
266
- @lifetime ( borrow mutableOwner)
266
+ @lifetime ( & mutableOwner)
267
267
init ( mutableOwner: inout AnyObject ) {
268
268
// Initialization of a ~Escapable value is unenforced. So we can initialize
269
269
// the `owner` property without locally borrowing `mutableOwner`.
@@ -432,13 +432,13 @@ func testGlobal(local: InnerTrivial) -> Span<Int> {
432
432
// Scoped dependence on mutable values
433
433
// =============================================================================
434
434
435
- @lifetime ( borrow a)
435
+ @lifetime ( & a)
436
436
func testInoutBorrow( a: inout [ Int ] ) -> Span < Int > {
437
437
a. span ( ) // expected-error {{lifetime-dependent value escapes its scope}}
438
438
// expected-note @-1{{it depends on this scoped access to variable 'a'}}
439
439
} // expected-note {{this use causes the lifetime-dependent value to escape}}
440
440
441
- @lifetime ( borrow a)
441
+ @lifetime ( & a)
442
442
func testInoutMutableBorrow( a: inout [ Int ] ) -> MutableSpan < Int > {
443
443
a. mutableSpan ( )
444
444
}
@@ -460,7 +460,7 @@ extension Container {
460
460
View ( owner: self . owner) // OK
461
461
}
462
462
463
- @lifetime ( borrow self)
463
+ @lifetime ( & self )
464
464
mutating func mutableView( ) -> MutableView {
465
465
// Reading 'self.owner' creates a local borrow scope. This new MutableView
466
466
// depends on a the local borrow scope for 'self.owner', so it cannot be
@@ -469,15 +469,15 @@ extension Container {
469
469
// expected-note @-1{{it depends on this scoped access to variable 'self'}}
470
470
} // expected-note {{this use causes the lifetime-dependent value to escape}}
471
471
472
- @lifetime ( borrow self)
472
+ @lifetime ( & self )
473
473
mutating func mutableViewModifiesOwner( ) -> MutableView {
474
474
// Passing '&self.owner' inout creates a nested exclusive access that must extend to all uses of the new
475
475
// MutableView. This is allowed because the nested access is logically extended to the end of the function (without
476
476
// violating exclusivity).
477
477
MutableView ( mutableOwner: & self . owner)
478
478
}
479
479
480
- @lifetime ( borrow self)
480
+ @lifetime ( & self )
481
481
mutating func mutableSpan( ) -> MutableSpan < T > {
482
482
// Reading 'self.pointer' creates a local borrow scope. The local borrow
483
483
// scope is ignored because 'pointer' is a trivial value. Instead, the new
0 commit comments