File tree 3 files changed +5
-12
lines changed
3 files changed +5
-12
lines changed Original file line number Diff line number Diff line change @@ -89,7 +89,6 @@ extension String {
89
89
/// print(String(s1.utf8.prefix(15))!)
90
90
/// // Prints "They call me 'B"
91
91
@frozen
92
- @_addressableForDependencies
93
92
public struct UTF8View : Sendable {
94
93
@usableFromInline
95
94
internal var _guts : _StringGuts
@@ -341,10 +340,7 @@ extension String.UTF8View {
341
340
#endif
342
341
let count = _guts. count
343
342
if _guts. isSmall {
344
- let a = Builtin . addressOfBorrow ( self )
345
- let address = unsafe UnsafePointer< UTF8 . CodeUnit > ( a)
346
- let span = unsafe Span( _unsafeStart: address, count: count)
347
- return unsafe _override Lifetime ( span, borrowing: self )
343
+ fatalError ( " Span over the small string form is not supported yet. " )
348
344
}
349
345
_precondition ( _guts. isFastUTF8)
350
346
let buffer = unsafe _guts. _object . fastUTF8
Original file line number Diff line number Diff line change @@ -630,7 +630,6 @@ extension Substring: LosslessStringConvertible {
630
630
631
631
extension Substring {
632
632
@frozen
633
- @_addressableForDependencies
634
633
public struct UTF8View : Sendable {
635
634
@usableFromInline
636
635
internal var _slice : Slice < String . UTF8View >
@@ -771,11 +770,7 @@ extension Substring.UTF8View {
771
770
let first = _slice. _startIndex. _encodedOffset
772
771
let end = _slice. _endIndex. _encodedOffset
773
772
if _wholeGuts. isSmall {
774
- let a = Builtin . addressOfBorrow ( self )
775
- let offset = first &+ ( 2 &* MemoryLayout< String . Index> . stride)
776
- let start = unsafe UnsafePointer< UTF8 . CodeUnit > ( a) . advanced ( by: offset)
777
- let span = unsafe Span( _unsafeStart: start, count: end &- first)
778
- return unsafe _override Lifetime ( span, borrowing: self )
773
+ fatalError ( " Span over the small string form is not supported yet. " )
779
774
}
780
775
_internalInvariant ( _wholeGuts. isFastUTF8)
781
776
let buffer = unsafe _wholeGuts . _object . fastUTF8 . extracting(
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 Span -enable-experimental-feature AddressableTypes)
13
+ // RUN: %target-run-stdlib-swift(-enable-experimental-feature LifetimeDependence -enable-experimental-feature AddressableTypes)
14
14
15
15
// REQUIRES: executable_test
16
16
@@ -25,6 +25,7 @@ suite.test("Span from Small String")
25
25
26
26
let s = " A small string. " . utf8
27
27
let u = Array ( s)
28
+ expectCrashLater ( )
28
29
let span = s. span
29
30
30
31
let count = span. count
@@ -57,6 +58,7 @@ suite.test("Span from Small String's Substring")
57
58
58
59
let s = " A small string. " . dropFirst ( 8 ) . utf8
59
60
let u = Array ( " string. " . utf8)
61
+ expectCrashLater ( )
60
62
let span = s. span
61
63
62
64
let count = span. count
You can’t perform that action at this time.
0 commit comments