Skip to content

Commit fa9f9fb

Browse files
committed
shield lifetime-dependence syntax
1 parent 9e8be79 commit fa9f9fb

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

Package.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ let package = Package(
145145
.when(platforms: [.macOS, .iOS, .watchOS, .tvOS, .linux])
146146
),
147147
.enableExperimentalFeature("AddressableTypes"),
148+
.enableExperimentalFeature("AllowUnsafeAttribute"),
148149
.enableExperimentalFeature("BuiltinModule"),
149150
.enableExperimentalFeature("AccessLevelOnImport")
150151
] + availabilityMacros + featureSettings,

Sources/FoundationEssentials/Data/Data.swift

Lines changed: 4 additions & 1 deletion
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 compiler(>=6.2) && $LifetimeDependence
22062207
@available(FoundationSpan 6.2, *)
22072208
public var bytes: RawSpan {
22082209
@lifetime(borrow self)
@@ -2238,6 +2239,7 @@ public struct Data : Equatable, Hashable, RandomAccessCollection, MutableCollect
22382239
return _overrideLifetime(span, borrowing: self)
22392240
}
22402241
}
2242+
#endif
22412243

22422244
#if compiler(>=5.9) && $InoutLifetimeDependence && $LifetimeDependenceMutableAccessors
22432245
@available(FoundationSpan 6.2, *)
@@ -2974,7 +2976,7 @@ extension Data : Codable {
29742976
}
29752977

29762978
// TODO: remove once _overrideLifetime is public in the standard library
2977-
2979+
#if compiler(>=6.2) && $LifetimeDependence
29782980
/// Unsafely discard any lifetime dependency on the `dependent` argument. Return
29792981
/// a value identical to `dependent` with a lifetime dependency on the caller's
29802982
/// borrow scope of the `source` argument.
@@ -3006,6 +3008,7 @@ internal func _overrideLifetime<
30063008
) -> T {
30073009
dependent
30083010
}
3011+
#endif
30093012

30103013
#if compiler(>=5.9) && $InoutLifetimeDependence && $LifetimeDependenceMutableAccessors
30113014
/// Unsafely discard any lifetime dependency on the `dependent` argument.

0 commit comments

Comments
 (0)