Skip to content

Commit 480a123

Browse files
authored
NFC: Resolve some Sendable-related warnings (#7822)
Assorted fixes for sendability warnings.
1 parent a2aa745 commit 480a123

File tree

5 files changed

+13
-7
lines changed

5 files changed

+13
-7
lines changed

Sources/Basics/Netrc.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import Foundation
1414

1515
/// Representation of Netrc configuration
16-
public struct Netrc {
16+
public struct Netrc: Sendable {
1717
/// Representation of `machine` connection settings & `default` connection settings.
1818
/// If `default` connection settings present, they will be last element.
1919
public let machines: [Machine]
@@ -37,7 +37,7 @@ public struct Netrc {
3737
}
3838

3939
/// Representation of connection settings
40-
public struct Machine: Equatable {
40+
public struct Machine: Equatable, Sendable {
4141
public let name: String
4242
public let login: String
4343
public let password: String
@@ -147,7 +147,6 @@ public enum NetrcError: Error, Equatable {
147147
}
148148

149149
private enum RegexUtil {
150-
@frozen
151150
fileprivate enum Token: String, CaseIterable {
152151
case machine, login, password, account, macdef, `default`
153152

Sources/_InternalTestSupport/MockArchiver.swift

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,23 @@
1313
import Basics
1414

1515
package final class MockArchiver: Archiver {
16-
package typealias ExtractionHandler = (
16+
package typealias ExtractionHandler = @Sendable (
1717
MockArchiver,
1818
AbsolutePath,
1919
AbsolutePath,
2020
(Result<Void, Error>) -> Void
2121
) throws -> Void
22-
package typealias CompressionHandler = (
22+
package typealias CompressionHandler = @Sendable (
2323
MockArchiver,
2424
AbsolutePath,
2525
AbsolutePath,
2626
(Result<Void, Error>) -> Void
2727
) throws -> Void
28-
package typealias ValidationHandler = (MockArchiver, AbsolutePath, (Result<Bool, Error>) -> Void) throws -> Void
28+
package typealias ValidationHandler = @Sendable (
29+
MockArchiver,
30+
AbsolutePath,
31+
(Result<Bool, Error>) -> Void
32+
) throws -> Void
2933

3034
package struct Extraction: Equatable {
3135
public let archivePath: AbsolutePath

Tests/BasicsTests/CancellatorTests.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@ final class CancellatorTests: XCTestCase {
348348
struct Worker {
349349
func work() {}
350350

351+
@Sendable
351352
func cancel() {
352353
Thread.sleep(forTimeInterval: 5)
353354
}
@@ -391,6 +392,7 @@ fileprivate struct Worker {
391392
return self.semaphore.wait(timeout: deadline)
392393
}
393394

395+
@Sendable
394396
func cancel() {
395397
print("\(self.name) cancel")
396398
self.semaphore.signal()

Tests/CommandsTests/PackageRegistryCommandTests.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,7 @@ final class PackageRegistryCommandTests: CommandsTestCase {
716716
)
717717
}
718718

719+
@Sendable
719720
func validateManifest(
720721
manifestFile: String,
721722
in archivePath: AbsolutePath,

Tests/CommandsTests/TestCommandTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ final class TestCommandTests: CommandsTestCase {
191191
}
192192

193193
try await fixture(name: "Miscellaneous/SkipTests") { fixturePath in
194-
let (stdout, stderr) = try await SwiftPM.Test.execute(["--skip", "Tests"], packagePath: fixturePath)
194+
let (stdout, _) = try await SwiftPM.Test.execute(["--skip", "Tests"], packagePath: fixturePath)
195195
// in "swift test" test output goes to stdout
196196
XCTAssertNoMatch(stdout, .contains("testExample1"))
197197
XCTAssertNoMatch(stdout, .contains("testExample2"))

0 commit comments

Comments
 (0)