modify the error message- CR Comments
This commit is contained in:
parent
e18a83be88
commit
e5a96a4b95
6 changed files with 35 additions and 28 deletions
|
|
@ -27,7 +27,7 @@ fn indirect_write_to_imm_box() {
|
|||
let y: Box<_> = box &mut x;
|
||||
let p = &y;
|
||||
***p = 2; //[ast]~ ERROR cannot assign to data in a `&` reference
|
||||
//[mir]~^ ERROR cannot assign through `&`-reference `p`
|
||||
//[mir]~^ ERROR cannot assign to data in a `&` reference
|
||||
drop(p);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -70,5 +70,5 @@ fn main() {
|
|||
};
|
||||
s[2] = 20;
|
||||
//[ast]~^ ERROR cannot assign to immutable indexed content
|
||||
//[mir]~^^ ERROR cannot assign through immutable item
|
||||
//[mir]~^^ ERROR cannot assign to immutable item
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
error[E0594]: cannot assign through `&`-reference `fancy_ref`
|
||||
error[E0594]: cannot assign to data in a `&` reference
|
||||
--> $DIR/issue-47388.rs:18:5
|
||||
|
|
||||
LL | let fancy_ref = &(&mut fancy);
|
||||
| ------------- help: consider changing this to be a mutable reference: `&mut`
|
||||
LL | fancy_ref.num = 6; //~ ERROR E0594
|
||||
| ^^^^^^^^^^^^^^^^^ cannot assign through `&`-reference
|
||||
| ^^^^^^^^^^^^^^^^^ `fancy_ref` is a `&` reference, so the data it refers to cannot be written
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue