Fix referencing WASILibc.stdout/stderr in Swift 6.5+ (#507)

### Motivation:

Nightly CI on nightly-main toolchains started failing on August 11, when
we started downloading swift-DEVELOPMENT-SNAPSHOT-2026-08-08 instead of
swift-DEVELOPMENT-SNAPSHOT-2026-07-11.

Appears to be fallout from
https://github.com/swiftlang/swift/commit/73fee3394d3102847fef26c1bdea49a67061f043
improving the optionality and concurrency of stdout/stderr/stdin on the
various platforms.

### Modifications:

Adapted Swift Log code to handle both the existing and behavior, guarded
by a `compiler(>=6.5)`

Also enabled nightly-next, which tracks the pre-release 6.4 right now,
but hasn't received this change.

### Result:

Passing CI, hopefully :)
This commit is contained in:
Honza Dvorsky authored and GitHub committed 2026-09-08 11:02:37 +01:00
1 parent 53d00853e6
commit 9c6fb14227
1 file changed
+12 -2
@@ -345,8 +345,13 @@ internal struct StdioOutputStream: TextOutputStream, @unchecked Sendable {
)
#elseif canImport(WASILibc)
// no file locking on WASI
#if compiler(>=6.5)
let file = WASILibc.stderr
#else
let file = WASILibc.stderr!
#endif
return StdioOutputStream(
file: WASILibc.stderr!,
file: file,
flushMode: .always,
lock: nil,
unlock: nil,
@@ -417,8 +422,13 @@ internal struct StdioOutputStream: TextOutputStream, @unchecked Sendable {
)
#elseif canImport(WASILibc)
// no file locking on WASI
#if compiler(>=6.5)
let file = WASILibc.stdout
#else
let file = WASILibc.stdout!
#endif
return StdioOutputStream(
file: WASILibc.stdout!,
file: file,
flushMode: .always,
lock: nil,
unlock: nil,