Closed
Description
STR
fn main() {
let mut y = 0;
|| {
let b = &y;
y += 1;
*b
};
}
Result
error[E0506]: cannot assign to `**y` because it is borrowed
--> src/main.rs:5:9
|
4 | let b = &y;
| - borrow of `**y` occurs here
5 | y += 1;
| ^^^^^^ assignment to borrowed `**y` occurs here
error: aborting due to previous error
y
is an integer, so **y
isn't actually a thing. We emit the dereferences because there are layers of indirection before we get to the upvar, but they aren't actually a part of the user-visible syntax.