modify the error message- CR Comments

This commit is contained in:
gaurikholkar 2018-04-07 10:54:13 +05:30
parent e18a83be88
commit e5a96a4b95
6 changed files with 35 additions and 28 deletions

View file

@ -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);
}

View file

@ -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
}

View file

@ -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