-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Closure captures immutable reference when mutable reference is necessary #88372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Bisected to #86995 cc @arora-aman |
the root cause is: if one place captured by more than 2 locations, the CaptureInfo will be overrided by the last one in processed.insert : rust/compiler/rustc_typeck/src/check/upvar.rs Line 403 in dfd6306
In this case, |
Thank you for this! |
Code
I tried this code:
I expected to see this happen: The code should compile.
Instead, this happened: This compiler error is thrown:
Version it worked on
It most recently worked on:
nightly-2021-07-11
(also works on stable 1.54). Starting fromnightly-2021-07-12
, I get the error shown above.Version with regression
rustc --version --verbose
: current nightlyAlso broken on 1.55 beta 7:
Both installed via rustup.
Backtrace
n/a
Additional information
This seems similar to #87814, which was fixed in #88266 / b03ccac (which AFAIU should be included in
nightly-2021-08-25
), but it still does not work.The text was updated successfully, but these errors were encountered: