File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed
lib/SILOptimizer/Mandatory
validation-test/SILOptimizer Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -259,6 +259,7 @@ struct SILMoveOnlyWrappedTypeEliminatorVisitor
259
259
}
260
260
ELIMINATE_POTENTIAL_IDENTITY_CAST (Upcast)
261
261
ELIMINATE_POTENTIAL_IDENTITY_CAST (UncheckedAddrCast)
262
+ ELIMINATE_POTENTIAL_IDENTITY_CAST (UncheckedRefCast)
262
263
ELIMINATE_POTENTIAL_IDENTITY_CAST (UnconditionalCheckedCast)
263
264
#undef ELIMINATE_POTENTIAL_IDENTITY_CAST
264
265
// We handle apply sites by just inserting a convert_function that converts
Original file line number Diff line number Diff line change @@ -39,3 +39,18 @@ extension Foo {
39
39
}
40
40
}
41
41
}
42
+
43
+ extension NSString {
44
+ var utf16Span : Span < UInt16 > ? {
45
+ @_lifetime ( borrow self)
46
+ borrowing get { // expected-error{{'self' is borrowed and cannot be consumed}}
47
+ guard let ptr = CFStringGetCharactersPtr ( self ) else { // expected-note{{consumed here}}
48
+ return nil
49
+ }
50
+ let length = self . length
51
+ let buffer = UnsafeBufferPointer ( start: ptr, count: length)
52
+ let span = unsafe Span< UInt16 > ( _unsafeElements: buffer)
53
+ return _overrideLifetime ( span, borrowing: self )
54
+ }
55
+ }
56
+ }
You can’t perform that action at this time.
0 commit comments