Skip to content

Commit e37fc23

Browse files
committed
Update lifetime tests for improved diagnostics
1 parent 44bffe3 commit e37fc23

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

test/SILOptimizer/lifetime_dependence/stdlib_span.swift

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,9 @@ func testUBPStorageCopy(ubp: UnsafeRawBufferPointer) -> RawSpan {
5454

5555
@available(SwiftStdlib 6.2, *)
5656
func testUBPStorageEscape(array: [Int64]) {
57-
var span = RawSpan()
58-
array.withUnsafeBytes {
59-
span = $0.storage // expected-error {{lifetime-dependent value escapes its scope}}
60-
// expected-note @-2{{it depends on the lifetime of argument '$0'}}
61-
// expected-note @-2{{this use causes the lifetime-dependent value to escape}}
62-
}
57+
var span = RawSpan() // expected-error{{lifetime-dependent variable 'span' escapes its scope}}
58+
array.withUnsafeBytes { // expected-note{{it depends on the lifetime of argument '$0'}}
59+
span = $0.storage
60+
} // expected-note{{this use causes the lifetime-dependent value to escape}}
6361
read(span)
6462
}

0 commit comments

Comments
 (0)