Potentially misleading error when holding a reference into a guard across await
point
#136349
Labels
A-async-await
Area: Async & Await
C-feature-request
Category: A feature request, i.e: not implemented / a PR.
T-lang
Relevant to the language team, which will review and decide on the PR/issue.
I tried this code:
Since we are already dropping the
_guard
, before calling await. This future should beSend
and should compile successfully.But for some reason the compiler complains that
The issue is probably caused the
let _ = _guard.get_mut(&0);
statement.I guess a more reasonable error could be that bound variable is holding a ref into the guard, which can be used later (I am not sure if that is infact the case).
Meta
Happens on Stable 1.84.1 and Nightly 1.86.0 as well
Playground: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=e5a6b1f10131890af79c6c6ab4e991e1
The text was updated successfully, but these errors were encountered: