diff options
Diffstat (limited to '')
-rw-r--r-- | tests/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.stderr | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.stderr b/tests/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.stderr new file mode 100644 index 000000000..cbacc87a0 --- /dev/null +++ b/tests/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.stderr @@ -0,0 +1,25 @@ +error[E0594]: cannot assign to `*s.pointer`, which is behind a `&` reference + --> $DIR/borrowck-assign-to-andmut-in-aliasable-loc.rs:9:5 + | +LL | *s.pointer += 1; + | ^^^^^^^^^^^^^^^ `s` is a `&` reference, so the data it refers to cannot be written + | +help: consider changing this to be a mutable reference + | +LL | fn a(s: &mut S<'_>) { + | ~~~~~~~~~~ + +error[E0594]: cannot assign to `*s.pointer`, which is behind a `&` reference + --> $DIR/borrowck-assign-to-andmut-in-aliasable-loc.rs:17:5 + | +LL | *s.pointer += 1; + | ^^^^^^^^^^^^^^^ `s` is a `&` reference, so the data it refers to cannot be written + | +help: consider changing this to be a mutable reference + | +LL | fn c(s: &mut &mut S<'_>) { + | ~~~~~~~~~~~~~~~ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0594`. |