You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 5, 2024. It is now read-only.
The borrow checker just prints the root variable when printing captures from within the context of the closure, we should update this to be print the captured path precisely.
Ideally, we do this once rust-lang/rust#80635 lands because it introduces a function to prints paths precisely.
error[E0502]: cannot borrow `p` as mutable because it is also borrowed as immutable
--> $DIR/borrowck-2.rs:12:17
|
LL | let y = &p.y;
| ---- immutable borrow occurs here
LL | let mut c = || {
| ^^ mutable borrow occurs here
LL | println!("{:?}", p);
| - `p` is captured because of use here
LL | let x = &mut p.x;
| --- `p` is borrowed mutably because of use here
...
LL | println!("{}", y);
| - immutable borrow later used here
Activity
arora-aman commentedon Feb 12, 2021
https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/fn.place_to_string_for_capture.html
arora-aman commentedon Feb 12, 2021
Search for FIXME(project-rfc_2229#36); https://oli-obk.github.io/fixmeh/
arora-aman commentedon Mar 17, 2021
Rollup merge of rust-lang#84358 - sexxi-goose:print_captures_borrowck…
Rollup merge of rust-lang#84358 - sexxi-goose:print_captures_borrowck…