Skip to content

Commit 25ceafc

Browse files
committedMar 18, 2025·
Fix 5.10 compile on Ubuntu 24.04
Specifically Swift 5.10 on Intel on Ubuntu Noble (24.04) has a crazy bug which leads to compilation failures in a #if compiler(>=6.0) block: swiftlang/swift#79285 . This workaround fixes the compilation by changing the whitespace.
1 parent 3c0f419 commit 25ceafc

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed
 

‎Sources/Metrics/Metrics.swift

+6-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
// SPDX-License-Identifier: Apache-2.0
1212
//
1313
//===----------------------------------------------------------------------===//
14+
// swift-format-ignore
15+
// Note: Whitespace changes are used to workaround compiler bug
16+
// https://github.com/swiftlang/swift/issues/79285
1417

1518
@_exported import CoreMetrics
1619
import Foundation
@@ -143,8 +146,9 @@ extension Timer {
143146
public func measure<Result, Failure: Error, Clock: _Concurrency.Clock>(
144147
clock: Clock = .continuous,
145148
isolation: isolated (any Actor)? = #isolation,
146-
body: () async throws(Failure) -> sending Result
147-
) async throws(Failure) -> sending Result where Clock.Duration == Duration {
149+
// DO NOT FIX THE WHITESPACE IN THE NEXT LINE UNTIL 5.10 IS UNSUPPORTED
150+
// https://github.com/swiftlang/swift/issues/79285
151+
body: () async throws(Failure) -> sending Result ) async throws(Failure) -> sending Result where Clock.Duration == Duration {
148152
let start = clock.now
149153
defer {
150154
self.record(duration: start.duration(to: clock.now))

0 commit comments

Comments
 (0)
Please sign in to comment.