For what it's worth, @Joe_Groff brought up the idea of an async defer { }
block in this pitch: async let and scoped suspension points (2021-06)
This rule would accommodate
async let
today, and makes space in the language to introduce other features with scoped implicit suspension points. If we were to reconsider allowingdefer
s that suspend, for instance, we could spell thoseasync defer
:func foo() async { await setup() // `async` signals potential implicit suspension on scope exit async defer { await teardown() } doStuff() }