async closure does not implement
FnMut because it captures state from its environment
for async closures, while closure returning async block works fine
#125247
Labels
C-bug
Category: This is a bug.
F-async_closure
`#![feature(async_closure)]`
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
I've returned to one of my projects after a few months of pause. Before I was using rust nigthly ~1.7x (around November 2023). It also worked through whole 2022 and 2021 IIRC. I've moved to new computer and installed rust nightly 1.80 (latest).
After upgrading I noticed that my whole codebase is full of errors around
async move |foo|
capturing something from environment.error: async closure does not implement `FnMut` because it captures state from its environment
. However if I changeasync |_| { ... }
to|_| async { ... }
it builds and works like previosly.Minimal example below.
The error for first method is:
i booted my very old PC to check, this is definately not the last version this worked fine:
rustc 1.70.0-nightly (ab654863c 2023-03-15)
I definately does not work with:
rustc 1.80.0-nightly (8387315ab 2024-05-14)
The text was updated successfully, but these errors were encountered: