]> git.lizzy.rs Git - rust.git/blob - src/test/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.stderr
Rollup merge of #102281 - RalfJung:invalid-enums, r=cjgillot
[rust.git] / src / test / ui / borrowck / borrowck-assign-to-andmut-in-aliasable-loc.stderr
1 error[E0594]: cannot assign to `*s.pointer`, which is behind a `&` reference
2   --> $DIR/borrowck-assign-to-andmut-in-aliasable-loc.rs:9:5
3    |
4 LL | fn a(s: &S) {
5    |         -- help: consider changing this to be a mutable reference: `&mut S<'_>`
6 LL |     *s.pointer += 1;
7    |     ^^^^^^^^^^^^^^^ `s` is a `&` reference, so the data it refers to cannot be written
8
9 error[E0594]: cannot assign to `*s.pointer`, which is behind a `&` reference
10   --> $DIR/borrowck-assign-to-andmut-in-aliasable-loc.rs:17:5
11    |
12 LL | fn c(s: & &mut S) {
13    |         -------- help: consider changing this to be a mutable reference: `&mut &mut S<'_>`
14 LL |     *s.pointer += 1;
15    |     ^^^^^^^^^^^^^^^ `s` is a `&` reference, so the data it refers to cannot be written
16
17 error: aborting due to 2 previous errors
18
19 For more information about this error, try `rustc --explain E0594`.