File tree Expand file tree Collapse file tree 3 files changed +3
-7
lines changed Expand file tree Collapse file tree 3 files changed +3
-7
lines changed Original file line number Diff line number Diff line change @@ -89,6 +89,7 @@ extension String {
89
89
/// print(String(s1.utf8.prefix(15))!)
90
90
/// // Prints "They call me 'B"
91
91
@frozen
92
+ @_addressableForDependencies
92
93
public struct UTF8View : Sendable {
93
94
@usableFromInline
94
95
internal var _guts : _StringGuts
@@ -348,7 +349,6 @@ extension String.UTF8View {
348
349
let a = Builtin . addressOfBorrow ( self )
349
350
let address = unsafe UnsafePointer< UTF8 . CodeUnit > ( a)
350
351
let span = unsafe Span( _unsafeStart: address, count: count)
351
- fatalError ( " Span over the small string form is not supported yet. " )
352
352
return unsafe _override Lifetime ( span, borrowing: self )
353
353
}
354
354
_precondition ( _guts. isFastUTF8)
Original file line number Diff line number Diff line change @@ -630,6 +630,7 @@ extension Substring: LosslessStringConvertible {
630
630
631
631
extension Substring {
632
632
@frozen
633
+ @_addressableForDependencies
633
634
public struct UTF8View : Sendable {
634
635
@usableFromInline
635
636
internal var _slice : Slice < String . UTF8View >
@@ -793,7 +794,6 @@ extension Substring.UTF8View {
793
794
let offset = first &+ ( 2 &* MemoryLayout< String . Index> . stride)
794
795
let start = unsafe UnsafePointer< UTF8 . CodeUnit > ( a) . advanced ( by: offset)
795
796
let span = unsafe Span( _unsafeStart: start, count: end &- first)
796
- fatalError ( " Span over the small string form is not supported yet. " )
797
797
return unsafe _override Lifetime ( span, borrowing: self )
798
798
}
799
799
_internalInvariant ( _wholeGuts. isFastUTF8)
Original file line number Diff line number Diff line change 10
10
//
11
11
//===----------------------------------------------------------------------===//
12
12
13
- // RUN: %target-run-stdlib-swift(-enable-experimental-feature LifetimeDependence -enable-experimental-feature AddressableTypes)
13
+ // RUN: %target-run-stdlib-swift(-enable-experimental-feature LifetimeDependence -enable-experimental-feature Span -enable-experimental-feature AddressableTypes)
14
14
15
15
// REQUIRES: executable_test
16
16
// REQUIRES: swift_feature_LifetimeDependence
@@ -22,13 +22,11 @@ var suite = TestSuite("StringUTF8StorageProperty")
22
22
defer { runAllTests ( ) }
23
23
24
24
suite. test ( " Span from Small String " )
25
- . skip ( . wasiAny( reason: " Trap tests aren't supported on WASI. " ) )
26
25
. require ( . stdlib_6_2) . code {
27
26
guard #available( SwiftStdlib 6 . 2 , * ) else { return }
28
27
29
28
let s = " A small string. " . utf8
30
29
let u = Array ( s)
31
- expectCrashLater ( )
32
30
let span = s. span
33
31
34
32
let count = span. count
@@ -56,13 +54,11 @@ suite.test("Span from Large Native String")
56
54
}
57
55
58
56
suite. test ( " Span from Small String's Substring " )
59
- . skip ( . wasiAny( reason: " Trap tests aren't supported on WASI. " ) )
60
57
. require ( . stdlib_6_2) . code {
61
58
guard #available( SwiftStdlib 6 . 2 , * ) else { return }
62
59
63
60
let s = " A small string. " . dropFirst ( 8 ) . utf8
64
61
let u = Array ( " string. " . utf8)
65
- expectCrashLater ( )
66
62
let span = s. span
67
63
68
64
let count = span. count
You can’t perform that action at this time.
0 commit comments