Skip to content

Commit 44491db

Browse files
authoredMar 18, 2025
Fix 5.10 compile on Ubuntu 24.04 (#168)
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. Fixes #166
1 parent 3c0f419 commit 44491db

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed
 

‎Sources/Metrics/Metrics.swift

+9-4
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-file
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
@@ -123,8 +126,9 @@ extension Timer {
123126
@available(macOS 13, iOS 16, tvOS 16, watchOS 9, *)
124127
public func measure<Result, Failure: Error, Clock: _Concurrency.Clock>(
125128
clock: Clock = .continuous,
126-
body: () throws(Failure) -> Result
127-
) throws(Failure) -> Result where Clock.Duration == Duration {
129+
// DO NOT FIX THE WHITESPACE IN THE NEXT LINE UNTIL 5.10 IS UNSUPPORTED
130+
// https://github.com/swiftlang/swift/issues/79285
131+
body: () throws(Failure) -> Result) throws(Failure) -> Result where Clock.Duration == Duration {
128132
let start = clock.now
129133
defer {
130134
self.record(duration: start.duration(to: clock.now))
@@ -143,8 +147,9 @@ extension Timer {
143147
public func measure<Result, Failure: Error, Clock: _Concurrency.Clock>(
144148
clock: Clock = .continuous,
145149
isolation: isolated (any Actor)? = #isolation,
146-
body: () async throws(Failure) -> sending Result
147-
) async throws(Failure) -> sending Result where Clock.Duration == Duration {
150+
// DO NOT FIX THE WHITESPACE IN THE NEXT LINE UNTIL 5.10 IS UNSUPPORTED
151+
// https://github.com/swiftlang/swift/issues/79285
152+
body: () async throws(Failure) -> sending Result) async throws(Failure) -> sending Result where Clock.Duration == Duration {
148153
let start = clock.now
149154
defer {
150155
self.record(duration: start.duration(to: clock.now))

0 commit comments

Comments
 (0)