We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0a3a830 commit 7e91c31Copy full SHA for 7e91c31
1 file changed
crates/hir-def/src/expr_store/lower.rs
@@ -1004,6 +1004,10 @@ impl<'db> ExprCollector<'db> {
1004
let coroutine = self.desugared_coroutine_expr(
1005
kind,
1006
coroutine_source,
1007
+ // The default capture mode here is by-ref. Later on during upvar analysis,
1008
+ // we will force the captured arguments to by-move, but for async closures,
1009
+ // we want to make sure that we avoid unnecessarily moving captures, or else
1010
+ // all async closures would default to `FnOnce` as their calling mode.
1011
CaptureBy::Ref,
1012
None,
1013
statements.into_boxed_slice(),
0 commit comments