Skip to content

Commit b989057

Browse files
authored
Merge pull request #64118 from etcwilde/ewilde/pretty-colors
Enable swift color diagnostics in stdlib
2 parents c73197e + 9fd0f26 commit b989057

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

stdlib/cmake/modules/SwiftSource.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ function(handle_swift_sources
131131
list(APPEND swift_compile_flags "${_lto_flag_out}")
132132
endif()
133133
endif()
134+
list(APPEND swift_compile_flags "-color-diagnostics")
134135
_compile_swift_files(
135136
dependency_target
136137
module_dependency_target

stdlib/public/Concurrency/AsyncStreamBuffer.swift

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ extension AsyncStream {
112112
let handler = state.onTermination
113113
state.onTermination = nil
114114
unlock()
115-
115+
116116
// handler must be invoked before yielding nil for termination
117117
handler?(.cancelled)
118118

@@ -124,7 +124,7 @@ extension AsyncStream {
124124
lock()
125125
let limit = state.limit
126126
let count = state.pending.count
127-
127+
128128
if !state.continuations.isEmpty {
129129
let continuation = state.continuations.removeFirst()
130130
if count > 0 {
@@ -170,7 +170,7 @@ extension AsyncStream {
170170
case .bufferingOldest(let limit):
171171
result = .enqueued(remaining: limit)
172172
}
173-
173+
174174
unlock()
175175
continuation.resume(returning: value)
176176
}
@@ -205,7 +205,7 @@ extension AsyncStream {
205205
}
206206
return result
207207
}
208-
208+
209209
func finish() {
210210
lock()
211211
let handler = state.onTermination
@@ -249,9 +249,9 @@ extension AsyncStream {
249249
} else {
250250
unlock()
251251
}
252-
252+
253253
}
254-
254+
255255
func next() async -> Element? {
256256
await withTaskCancellationHandler { [cancel] in
257257
cancel()
@@ -289,7 +289,7 @@ extension AsyncThrowingStream {
289289
case finished
290290
case failed(Failure)
291291
}
292-
292+
293293
struct State {
294294
var continuation: UnsafeContinuation<Element?, Error>?
295295
var pending = _Deque<Element>()
@@ -345,7 +345,7 @@ extension AsyncThrowingStream {
345345
let handler = state.onTermination
346346
state.onTermination = nil
347347
unlock()
348-
348+
349349
// handler must be invoked before yielding nil for termination
350350
handler?(.cancelled)
351351

@@ -409,7 +409,7 @@ extension AsyncThrowingStream {
409409
case .bufferingNewest(let limit):
410410
result = .enqueued(remaining: limit)
411411
}
412-
412+
413413
state.continuation = nil
414414
unlock()
415415
continuation.resume(returning: value)
@@ -445,7 +445,7 @@ extension AsyncThrowingStream {
445445
}
446446
return result
447447
}
448-
448+
449449
func finish(throwing error: __owned Failure? = nil) {
450450
lock()
451451
let handler = state.onTermination
@@ -510,7 +510,7 @@ extension AsyncThrowingStream {
510510
fatalError("attempt to await next() on more than one task")
511511
}
512512
}
513-
513+
514514
func next() async throws -> Element? {
515515
try await withTaskCancellationHandler { [cancel] in
516516
cancel()
@@ -546,7 +546,7 @@ final class _AsyncStreamCriticalStorage<Contents>: @unchecked Sendable {
546546
private init(_doNotCallMe: ()) {
547547
fatalError("_AsyncStreamCriticalStorage must be initialized by create")
548548
}
549-
549+
550550
private func lock() {
551551
let ptr =
552552
UnsafeRawPointer(Builtin.projectTailElems(self, UnsafeRawPointer.self))
@@ -558,15 +558,15 @@ final class _AsyncStreamCriticalStorage<Contents>: @unchecked Sendable {
558558
UnsafeRawPointer(Builtin.projectTailElems(self, UnsafeRawPointer.self))
559559
_unlock(ptr)
560560
}
561-
561+
562562
var value: Contents {
563563
get {
564564
lock()
565565
let contents = _value
566566
unlock()
567567
return contents
568568
}
569-
569+
570570
set {
571571
lock()
572572
withExtendedLifetime(_value) {
@@ -575,7 +575,7 @@ final class _AsyncStreamCriticalStorage<Contents>: @unchecked Sendable {
575575
}
576576
}
577577
}
578-
578+
579579
static func create(_ initial: Contents) -> _AsyncStreamCriticalStorage {
580580
let minimumCapacity = _lockWordCount()
581581
let storage = Builtin.allocWithTailElems_1(

0 commit comments

Comments
 (0)