Skip to content

Commit 49f2159

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 49f2159

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

Package.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ let package = Package(
135135
swiftSettings: [
136136
.enableExperimentalFeature("VariadicGenerics"),
137137
.enableExperimentalFeature("LifetimeDependence"),
138+
.enableExperimentalFeature("LifetimeDependenceMutableAccessors", .when(platforms: [.macOS, .linux])),
138139
.enableExperimentalFeature("AddressableTypes"),
139140
.enableExperimentalFeature("BuiltinModule"),
140141
.enableExperimentalFeature("AccessLevelOnImport")

Sources/FoundationEssentials/Data/Data.swift

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2239,6 +2239,7 @@ public struct Data : Equatable, Hashable, RandomAccessCollection, MutableCollect
22392239
}
22402240
}
22412241

2242+
#if $LifetimeDependenceMutableAccessors && !os(Windows)
22422243
@available(FoundationSpan 6.2, *)
22432244
public var mutableBytes: MutableRawSpan {
22442245
@lifetime(&self)
@@ -2298,6 +2299,7 @@ public struct Data : Equatable, Hashable, RandomAccessCollection, MutableCollect
22982299
#endif
22992300
}
23002301
}
2302+
#endif // $LifetimeDependenceMutableAccessors && !os(Windows)
23012303

23022304
@_alwaysEmitIntoClient
23032305
public func withContiguousStorageIfAvailable<ResultType>(_ body: (_ buffer: UnsafeBufferPointer<UInt8>) throws -> ResultType) rethrows -> ResultType? {
@@ -2950,7 +2952,7 @@ extension Data : Codable {
29502952
}
29512953

29522954
// TODO: remove once _overrideLifetime is public in the standard library
2953-
2955+
#if $LifetimeDependenceMutableAccessors && !os(Windows)
29542956
/// Unsafely discard any lifetime dependency on the `dependent` argument. Return
29552957
/// a value identical to `dependent` with a lifetime dependency on the caller's
29562958
/// borrow scope of the `source` argument.
@@ -2964,8 +2966,6 @@ internal func _overrideLifetime<
29642966
>(
29652967
_ dependent: consuming T, borrowing source: borrowing U
29662968
) -> T {
2967-
// TODO: Remove @_unsafeNonescapableResult. Instead, the unsafe dependence
2968-
// should be expressed by a builtin that is hidden within the function body.
29692969
dependent
29702970
}
29712971

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

@@ -3001,7 +2999,6 @@ internal func _overrideLifetime<
30012999
_ dependent: consuming T,
30023000
mutating source: inout U
30033001
) -> T {
3004-
// TODO: Remove @_unsafeNonescapableResult. Instead, the unsafe dependence
3005-
// should be expressed by a builtin that is hidden within the function body.
30063002
dependent
30073003
}
3004+
#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)