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
259259 }
260260 ELIMINATE_POTENTIAL_IDENTITY_CAST (Upcast)
261261 ELIMINATE_POTENTIAL_IDENTITY_CAST (UncheckedAddrCast)
262+ ELIMINATE_POTENTIAL_IDENTITY_CAST (UncheckedRefCast)
262263 ELIMINATE_POTENTIAL_IDENTITY_CAST (UnconditionalCheckedCast)
263264#undef ELIMINATE_POTENTIAL_IDENTITY_CAST
264265 // 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 {
3939 }
4040 }
4141}
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