Mutex
allows to return the protected Value
instance without reinitialization
#81274
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
triage needed
This issue needs more specific labels
Description
From the
Mutex
proposal, following code is unsafe and it's correctly diagnosed:The same diagnostic however isn't applied when we simply return the protected state from the closure passed to
withLock
method (see reproduction).Reproduction
Expected behavior
Returning
inout sending
value should require reinitialization.Environment
Apple Swift version 6.1 (swift-6.1-RELEASE)
Target: arm64-apple-macosx15.0
Additional information
No response
The text was updated successfully, but these errors were encountered: