]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.stderr
Rollup merge of #106726 - cmorin6:fix-comment-typos, r=Nilstrieb
[rust.git] / tests / 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 |     *s.pointer += 1;
5    |     ^^^^^^^^^^^^^^^ `s` is a `&` reference, so the data it refers to cannot be written
6    |
7 help: consider changing this to be a mutable reference
8    |
9 LL | fn a(s: &mut S<'_>) {
10    |         ~~~~~~~~~~
11
12 error[E0594]: cannot assign to `*s.pointer`, which is behind a `&` reference
13   --> $DIR/borrowck-assign-to-andmut-in-aliasable-loc.rs:17:5
14    |
15 LL |     *s.pointer += 1;
16    |     ^^^^^^^^^^^^^^^ `s` is a `&` reference, so the data it refers to cannot be written
17    |
18 help: consider changing this to be a mutable reference
19    |
20 LL | fn c(s: &mut &mut S<'_>) {
21    |         ~~~~~~~~~~~~~~~
22
23 error: aborting due to 2 previous errors
24
25 For more information about this error, try `rustc --explain E0594`.