Skip to content

Relax escaping requirement for closures in Async{Lock|Mutex}#781

Open
jamieQ wants to merge 1 commit into
apple:mainfrom
jamieQ:relax-escaping-requirement
Open

Relax escaping requirement for closures in Async{Lock|Mutex}#781
jamieQ wants to merge 1 commit into
apple:mainfrom
jamieQ:relax-escaping-requirement

Conversation

@jamieQ

@jamieQ jamieQ commented Jun 26, 2026

Copy link
Copy Markdown

I was looking into why #696 was implemented, which was a fix for new warnings in the 6.4 compiler, and was confused why the diagnostic would be firing in the case it appeared to address. It turns out this was due to the AsyncMutex.withLock method taking an escaping closure parameter. However, the closure does not actually escape, so we can undo that prior workaround and make the API slightly more general by dropping the @escaping attribute. The same reasoning applies to AsyncLock as well, so for consistency I applied the change there too.

This does alter a public API though and I'm not sure what the source compatibility goals of this project are exactly, so let me know if you think that will be problematic.

@crosbymichael

Copy link
Copy Markdown
Contributor

@jamieQ Change looks good and makes a lot of sense to me. We do require signed commits. They are easy to setup with SSH keys if you get a chance.

The closures do not actually escape within the method bodies, so
drop `@escaping` from the parameters.
@jamieQ jamieQ force-pushed the relax-escaping-requirement branch from 01562bc to f27d20f Compare July 15, 2026 09:10
@jamieQ

jamieQ commented Jul 15, 2026

Copy link
Copy Markdown
Author

Thanks @crosbymichael – I tried to get the signed commit stuff configured correctly, but I think it may have invalidated the review. LMK if there's anything else I need to do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants