about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/test/ui/nll/issue-51244.rs3
-rw-r--r--src/test/ui/nll/issue-51244.stderr8
2 files changed, 6 insertions, 5 deletions
diff --git a/src/test/ui/nll/issue-51244.rs b/src/test/ui/nll/issue-51244.rs
index 56d9449c467..f00ad3d6505 100644
--- a/src/test/ui/nll/issue-51244.rs
+++ b/src/test/ui/nll/issue-51244.rs
@@ -12,5 +12,6 @@
 
 fn main() {
     let ref my_ref @ _ = 0;
-    *my_ref = 0; //~ ERROR cannot assign to data in a `&` reference [E0594]
+    *my_ref = 0;
+    //~^ ERROR cannot assign to `*my_ref` which is behind a `&` reference [E0594]
 }
diff --git a/src/test/ui/nll/issue-51244.stderr b/src/test/ui/nll/issue-51244.stderr
index f1f47fc61ce..4e04aec8fe1 100644
--- a/src/test/ui/nll/issue-51244.stderr
+++ b/src/test/ui/nll/issue-51244.stderr
@@ -1,10 +1,10 @@
-error[E0594]: cannot assign to data in a `&` reference
+error[E0594]: cannot assign to `*my_ref` which is behind a `&` reference
   --> $DIR/issue-51244.rs:15:5
    |
 LL |     let ref my_ref @ _ = 0;
-   |         -------------- help: consider changing this to be a mutable reference: `&mut ef my_ref @ _`
-LL |     *my_ref = 0; //~ ERROR cannot assign to data in a `&` reference [E0594]
-   |     ^^^^^^^^^^^
+   |         -------------- help: consider changing this to be a mutable reference: `ref mut my_ref @ _`
+LL |     *my_ref = 0;
+   |     ^^^^^^^^^^^ `my_ref` is a `&` reference, so the data it refers to cannot be written
 
 error: aborting due to previous error