Skip to content

Commit 113bfc7

Browse files
authored
Merge pull request #67932 from tshortli/restore-task-local-with-value-impl-consume
Concurrency: Restore consume in TaskLocal.withValueImpl<R>(_:operation:)
2 parents cedbdf9 + 5cc7fff commit 113bfc7

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

stdlib/public/BackDeployConcurrency/TaskLocal.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ public final class TaskLocal<Value: Sendable>: Sendable, CustomStringConvertible
171171
// check if we're not trying to bind a value from an illegal context; this may crash
172172
_checkIllegalTaskLocalBindingWithinWithTaskGroup(file: file, line: line)
173173

174-
_taskLocalValuePush(key: key, value: valueDuringOperation)
174+
_taskLocalValuePush(key: key, value: consume valueDuringOperation)
175175
defer { _taskLocalValuePop() }
176176

177177
return try await operation()

stdlib/public/Concurrency/TaskLocal.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ public final class TaskLocal<Value: Sendable>: Sendable, CustomStringConvertible
171171
// check if we're not trying to bind a value from an illegal context; this may crash
172172
_checkIllegalTaskLocalBindingWithinWithTaskGroup(file: file, line: line)
173173

174-
_taskLocalValuePush(key: key, value: valueDuringOperation)
174+
_taskLocalValuePush(key: key, value: consume valueDuringOperation)
175175
defer { _taskLocalValuePop() }
176176

177177
return try await operation()

0 commit comments

Comments
 (0)