Open mattmassicotte opened 1 month ago
I originally thought this was due to the conditional compliation, but its actually any invalid syntax in Package.swift that causes a crash.
Turns out this is an issue with typed throws, I managed to reproduce this after building a toolchain of release/6.0 with --swiftpm --llbuild --infer
it crashes in:
* thread apple/swift-package-manager#11, queue = 'swift.org.swiftpm.shared.concurrent', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
* frame #0: 0x0000000000000000
frame apple/swift-package-manager#1: 0x000000010008f884 swift-build`swift_willThrowTyped at <compiler-generated>:0
frame apple/swift-package-manager#2: 0x000000010008e1dc swift-build`$ss6ResultOsRi_zrlE3getxyq_YKF at <compiler-generated>:0
frame apple/swift-package-manager#3: 0x0000000100a3d6f0 swift-build`closure apple/swift-package-manager#3 in ManifestLoader.load(manifestPath:manifestToolsVersion:packageIdentity:packageKind:packageLocation:packageVersion:identityResolver:dependencyMapper:fileSystem:observabilityScope:delegateQueue:callbackQueue:completion:) at ManifestLoader.swift:415
Because stdlib Result.get()
adopted typed throws:
@_alwaysEmitIntoClient
public consuming func get() throws(Failure) -> Success
With Xcode compiler instead of crashing we get a correct diagnostic because package uses tools-version: 5.10
:
error: 'v6' is unavailable
5 │
6 │ #if compiler(>=6.0)
7 │ let swiftVersions: [SwiftVersion] = [.v5, .v6]
│ ╰─ error: 'v6' is unavailable
8 │ #else
9 │ let swiftVersions: [SwiftVersion] = [.v5]
note: 'v6' was introduced in PackageDescription 6
170 │ /// The identifier for the Swift 6 language version.
171 │ @available(_PackageDescription, introduced: 6)
172 │ case v6
│ ╰─ note: 'v6' was introduced in PackageDescription 6
173 │
174 │ /// A user-defined value for the Swift version.
cc @DougGregor
Maybe @mikeash too?
I think this is the thing where some older runtimes consider OS version 9999 to be available. Doug has a hack to address it, not sure what the plan is with it: https://github.com/apple/swift/pull/72801
Is it reproducible with SwiftPM command-line tools:
swift build
,swift test
,swift package
etc?Description
The following package definition causes a crash with the Swift 6 May 26 release. It works fine with Swift 5.10 tools.
Expected behavior
I would expect this manifest to be accepted without issue.
Actual behavior
Steps to reproduce
/Library/Developer/Toolchains/swift-6.0-DEVELOPMENT-SNAPSHOT-2024-05-26-a.xctoolchain/usr/bin/swift build
Swift Package Manager version/commit hash
No response
Swift & OS version (output of
swift --version ; uname -a
)