File tree Expand file tree Collapse file tree 3 files changed +7
-3
lines changed Expand file tree Collapse file tree 3 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -89,7 +89,6 @@ extension String {
8989 /// print(String(s1.utf8.prefix(15))!)
9090 /// // Prints "They call me 'B"
9191 @frozen
92- @_addressableForDependencies
9392 public struct UTF8View : Sendable {
9493 @usableFromInline
9594 internal var _guts : _StringGuts
@@ -344,6 +343,7 @@ extension String.UTF8View {
344343 let a = Builtin . addressOfBorrow ( self )
345344 let address = unsafe UnsafePointer< UTF8 . CodeUnit > ( a)
346345 let span = unsafe Span( _unsafeStart: address, count: count)
346+ fatalError ( " Span over the small string form is not supported yet. " )
347347 return unsafe _override Lifetime ( span, borrowing: self )
348348 }
349349 _precondition ( _guts. isFastUTF8)
Original file line number Diff line number Diff line change @@ -630,7 +630,6 @@ extension Substring: LosslessStringConvertible {
630630
631631extension Substring {
632632 @frozen
633- @_addressableForDependencies
634633 public struct UTF8View : Sendable {
635634 @usableFromInline
636635 internal var _slice : Slice < String . UTF8View >
@@ -775,6 +774,7 @@ extension Substring.UTF8View {
775774 let offset = first &+ ( 2 &* MemoryLayout< String . Index> . stride)
776775 let start = unsafe UnsafePointer< UTF8 . CodeUnit > ( a) . advanced ( by: offset)
777776 let span = unsafe Span( _unsafeStart: start, count: end &- first)
777+ fatalError ( " Span over the small string form is not supported yet. " )
778778 return unsafe _override Lifetime ( span, borrowing: self )
779779 }
780780 _internalInvariant ( _wholeGuts. isFastUTF8)
Original file line number Diff line number Diff line change 1010//
1111//===----------------------------------------------------------------------===//
1212
13- // RUN: %target-run-stdlib-swift(-enable-experimental-feature LifetimeDependence -enable-experimental-feature Span -enable-experimental-feature AddressableTypes)
13+ // RUN: %target-run-stdlib-swift(-enable-experimental-feature LifetimeDependence -enable-experimental-feature AddressableTypes)
1414
1515// REQUIRES: executable_test
1616// REQUIRES: swift_feature_LifetimeDependence
@@ -22,11 +22,13 @@ var suite = TestSuite("StringUTF8StorageProperty")
2222defer { runAllTests ( ) }
2323
2424suite. test ( " Span from Small String " )
25+ . skip ( . wasiAny( reason: " Trap tests aren't supported on WASI. " ) )
2526. require ( . stdlib_6_2) . code {
2627 guard #available( SwiftStdlib 6 . 2 , * ) else { return }
2728
2829 let s = " A small string. " . utf8
2930 let u = Array ( s)
31+ expectCrashLater ( )
3032 let span = s. span
3133
3234 let count = span. count
@@ -54,11 +56,13 @@ suite.test("Span from Large Native String")
5456}
5557
5658suite. test ( " Span from Small String's Substring " )
59+ . skip ( . wasiAny( reason: " Trap tests aren't supported on WASI. " ) )
5760. require ( . stdlib_6_2) . code {
5861 guard #available( SwiftStdlib 6 . 2 , * ) else { return }
5962
6063 let s = " A small string. " . dropFirst ( 8 ) . utf8
6164 let u = Array ( " string. " . utf8)
65+ expectCrashLater ( )
6266 let span = s. span
6367
6468 let count = span. count
You can’t perform that action at this time.
0 commit comments