We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents fb87e7c + 57ac317 commit 96a267eCopy full SHA for 96a267e
src/test/ui/borrowck/issue-92015.rs
@@ -0,0 +1,7 @@
1
+// Regression test for #92105.
2
+// ICE when mutating immutable reference from last statement of a block.
3
+
4
+fn main() {
5
+ let foo = Some(&0).unwrap();
6
+ *foo = 1; //~ ERROR cannot assign
7
+}
src/test/ui/borrowck/issue-92015.stderr
@@ -0,0 +1,11 @@
+error[E0594]: cannot assign to `*foo`, which is behind a `&` reference
+ --> $DIR/issue-92015.rs:6:5
+ |
+LL | let foo = Some(&0).unwrap();
+ | --- help: consider changing this to be a mutable reference: `&mut i32`
+LL | *foo = 1;
+ | ^^^^^^^^ `foo` is a `&` reference, so the data it refers to cannot be written
8
9
+error: aborting due to previous error
10
11
+For more information about this error, try `rustc --explain E0594`.
0 commit comments