Skip to content

Commit edf036e

Browse files
committed
temporarily disable Span and MutableSpan for Windows
The current Windows nightly is too old to be able to compile the expected syntax.
1 parent 759820e commit edf036e

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

Sources/FoundationEssentials/Data/Data.swift

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2203,6 +2203,7 @@ public struct Data : Equatable, Hashable, RandomAccessCollection, MutableCollect
22032203
return try _representation.withUnsafeBytes(body)
22042204
}
22052205

2206+
#if !os(Windows)
22062207
@available(FoundationSpan 6.2, *)
22072208
public var bytes: RawSpan {
22082209
@lifetime(borrow self)
@@ -2241,7 +2242,9 @@ public struct Data : Equatable, Hashable, RandomAccessCollection, MutableCollect
22412242

22422243
@available(FoundationSpan 6.2, *)
22432244
public var mutableBytes: MutableRawSpan {
2245+
#if compiler(>=6.2)
22442246
@lifetime(&self)
2247+
#endif
22452248
mutating get {
22462249
let buffer: UnsafeMutableRawBufferPointer
22472250
switch _representation {
@@ -2268,7 +2271,9 @@ public struct Data : Equatable, Hashable, RandomAccessCollection, MutableCollect
22682271

22692272
@available(FoundationSpan 6.2, *)
22702273
public var mutableSpan: MutableSpan<UInt8> {
2274+
#if compiler(>=6.2)
22712275
@lifetime(&self)
2276+
#endif
22722277
mutating get {
22732278
#if false // see https://github.com/swiftlang/swift/issues/81218
22742279
var bytes = mutableBytes
@@ -2298,6 +2303,7 @@ public struct Data : Equatable, Hashable, RandomAccessCollection, MutableCollect
22982303
#endif
22992304
}
23002305
}
2306+
#endif // !os(Windows)
23012307

23022308
@_alwaysEmitIntoClient
23032309
public func withContiguousStorageIfAvailable<ResultType>(_ body: (_ buffer: UnsafeBufferPointer<UInt8>) throws -> ResultType) rethrows -> ResultType? {
@@ -2950,7 +2956,7 @@ extension Data : Codable {
29502956
}
29512957

29522958
// TODO: remove once _overrideLifetime is public in the standard library
2953-
2959+
#if !os(Windows)
29542960
/// Unsafely discard any lifetime dependency on the `dependent` argument. Return
29552961
/// a value identical to `dependent` with a lifetime dependency on the caller's
29562962
/// borrow scope of the `source` argument.
@@ -2964,8 +2970,6 @@ internal func _overrideLifetime<
29642970
>(
29652971
_ dependent: consuming T, borrowing source: borrowing U
29662972
) -> T {
2967-
// TODO: Remove @_unsafeNonescapableResult. Instead, the unsafe dependence
2968-
// should be expressed by a builtin that is hidden within the function body.
29692973
dependent
29702974
}
29712975

@@ -2982,8 +2986,6 @@ internal func _overrideLifetime<
29822986
>(
29832987
_ dependent: consuming T, copying source: borrowing U
29842988
) -> T {
2985-
// TODO: Remove @_unsafeNonescapableResult. Instead, the unsafe dependence
2986-
// should be expressed by a builtin that is hidden within the function body.
29872989
dependent
29882990
}
29892991

@@ -3001,7 +3003,6 @@ internal func _overrideLifetime<
30013003
_ dependent: consuming T,
30023004
mutating source: inout U
30033005
) -> T {
3004-
// TODO: Remove @_unsafeNonescapableResult. Instead, the unsafe dependence
3005-
// should be expressed by a builtin that is hidden within the function body.
30063006
dependent
30073007
}
3008+
#endif

Tests/FoundationEssentialsTests/DataTests.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1634,6 +1634,7 @@ class DataTests : XCTestCase {
16341634
// source.advanced(by: 5)
16351635
}
16361636

1637+
#if !os(Windows)
16371638
func test_InlineDataSpan() throws {
16381639
guard #available(FoundationSpan 6.2, *) else { throw XCTSkip("Span not available") }
16391640

@@ -1777,6 +1778,7 @@ class DataTests : XCTestCase {
17771778
XCTAssertEqual(source[i], 0)
17781779
XCTAssertEqual(source[i+1], .max)
17791780
}
1781+
#endif // !os(Windows)
17801782

17811783
#if false // FIXME: XCTest doesn't support crash tests yet rdar://20195010&22387653
17821784
func test_bounding_failure_subdata() {

0 commit comments

Comments
 (0)