Skip to content

Commit a9f3c35

Browse files
Drop Swift 5.10 (#71)
### Motivation: Swift 5.10 is no longer supported, we should bump the swift-tools version. ### Modifications: * Update Swift tools version to 6.0 ### Result: Code reflects our support window.
1 parent b8731d8 commit a9f3c35

File tree

2 files changed

+24
-12
lines changed

2 files changed

+24
-12
lines changed

Package.swift

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.10
1+
// swift-tools-version:6.0
22
//===----------------------------------------------------------------------===//
33
//
44
// This source file is part of the SwiftNIO open source project
@@ -14,6 +14,20 @@
1414
//===----------------------------------------------------------------------===//
1515
import PackageDescription
1616

17+
let strictConcurrencyDevelopment = false
18+
19+
let strictConcurrencySettings: [SwiftSetting] = {
20+
var initialSettings: [SwiftSetting] = []
21+
22+
if strictConcurrencyDevelopment {
23+
// -warnings-as-errors here is a workaround so that IDE-based development can
24+
// get tripped up on -require-explicit-sendable.
25+
initialSettings.append(.unsafeFlags(["-require-explicit-sendable", "-warnings-as-errors"]))
26+
}
27+
28+
return initialSettings
29+
}()
30+
1731
let package = Package(
1832
name: "swift-http-structured-headers",
1933
products: [
@@ -29,29 +43,27 @@ let package = Package(
2943
targets: [
3044
.target(
3145
name: "RawStructuredFieldValues",
32-
dependencies: []
46+
dependencies: [],
47+
swiftSettings: strictConcurrencySettings
3348
),
3449
.target(
3550
name: "StructuredFieldValues",
36-
dependencies: ["RawStructuredFieldValues"]
51+
dependencies: ["RawStructuredFieldValues"],
52+
swiftSettings: strictConcurrencySettings
3753
),
3854
.executableTarget(
3955
name: "sh-parser",
40-
dependencies: ["RawStructuredFieldValues"]
56+
dependencies: ["RawStructuredFieldValues"],
57+
swiftSettings: strictConcurrencySettings
4158
),
4259
.testTarget(
4360
name: "StructuredFieldValuesTests",
44-
dependencies: ["RawStructuredFieldValues", "StructuredFieldValues"]
61+
dependencies: ["RawStructuredFieldValues", "StructuredFieldValues"],
62+
swiftSettings: strictConcurrencySettings
4563
),
4664
]
4765
)
4866

49-
for target in package.targets {
50-
var settings = target.swiftSettings ?? []
51-
settings.append(.enableExperimentalFeature("StrictConcurrency=complete"))
52-
target.swiftSettings = settings
53-
}
54-
5567
// --- STANDARD CROSS-REPO SETTINGS DO NOT EDIT --- //
5668
for target in package.targets {
5769
switch target.type {

Sources/RawStructuredFieldValues/FieldParser.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ extension StructuredFieldValueParser {
560560
let unicodeSequence = byteArray.withUnsafeBytes {
561561
$0.withMemoryRebound(to: CChar.self) {
562562
// This force-unwrap is safe, as the buffer must successfully bind to CChar.
563-
String(validatingUTF8: $0.baseAddress!)
563+
String(validatingCString: $0.baseAddress!)
564564
}
565565
}
566566

0 commit comments

Comments
 (0)