]> git.lizzy.rs Git - rust.git/blob - src/test/ui/nll/reference-carried-through-struct-field.ast.nll.stderr
Auto merge of #54720 - davidtwco:issue-51191, r=nikomatsakis
[rust.git] / src / test / ui / nll / reference-carried-through-struct-field.ast.nll.stderr
1 error[E0503]: cannot use `x` because it was mutably borrowed
2   --> $DIR/reference-carried-through-struct-field.rs:21:5
3    |
4 LL |     let wrapper = Wrap { w: &mut x };
5    |                             ------ borrow of `x` occurs here
6 LL |     x += 1; //[ast]~ ERROR cannot assign to `x` because it is borrowed [E0506]
7    |     ^^^^^^ use of borrowed `x`
8 LL |     //[mir]~^ ERROR cannot use `x` because it was mutably borrowed [E0503]
9 LL |     *wrapper.w += 1;
10    |     --------------- borrow later used here
11
12 error: aborting due to previous error
13
14 For more information about this error, try `rustc --explain E0503`.