Skip to content

Commit 50b34c7

Browse files
authored
TSCBasic: mark Path-conforming types Sendable (#361)
These types only have a trivial `String` stored property in their implementation. Marking them as `Sendable` seems safe and allows them to be freely used in `async` contexts.
1 parent 22434bc commit 50b34c7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Sources/TSCBasic/Path.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ import var Foundation.NSLocalizedDescriptionKey
4141
/// normalization, because it is normally the responsibility of the shell and
4242
/// not the program being invoked (e.g. when invoking `cd ~`, it is the shell
4343
/// that evaluates the tilde; the `cd` command receives an absolute path).
44-
public struct AbsolutePath: Hashable {
44+
public struct AbsolutePath: Hashable, Sendable {
4545
/// Check if the given name is a valid individual path component.
4646
///
4747
/// This only checks with regard to the semantics enforced by `AbsolutePath`
@@ -231,7 +231,7 @@ public struct AbsolutePath: Hashable {
231231
/// This string manipulation may change the meaning of a path if any of the
232232
/// path components are symbolic links on disk. However, the file system is
233233
/// never accessed in any way when initializing a RelativePath.
234-
public struct RelativePath: Hashable {
234+
public struct RelativePath: Hashable, Sendable {
235235
/// Private implementation details, shared with the AbsolutePath struct.
236236
fileprivate let _impl: PathImpl
237237

@@ -462,7 +462,7 @@ extension Path {
462462
}
463463

464464
#if os(Windows)
465-
private struct WindowsPath: Path {
465+
private struct WindowsPath: Path, Sendable {
466466
let string: String
467467

468468
// NOTE: this is *NOT* a root path. It is a drive-relative path that needs
@@ -611,7 +611,7 @@ private struct WindowsPath: Path {
611611
}
612612
}
613613
#else
614-
private struct UNIXPath: Path {
614+
private struct UNIXPath: Path, Sendable {
615615
let string: String
616616

617617
static let root = Self(string: "/")

0 commit comments

Comments
 (0)