diff options
Diffstat (limited to 'tests/ui/error-codes/E0389.rs')
-rw-r--r-- | tests/ui/error-codes/E0389.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/ui/error-codes/E0389.rs b/tests/ui/error-codes/E0389.rs new file mode 100644 index 000000000..41172b362 --- /dev/null +++ b/tests/ui/error-codes/E0389.rs @@ -0,0 +1,10 @@ +struct FancyNum { + num: u8, +} + +fn main() { + let mut fancy = FancyNum{ num: 5 }; + let fancy_ref = &(&mut fancy); + fancy_ref.num = 6; //~ ERROR cannot assign to `fancy_ref.num`, which is behind a `&` reference + println!("{}", fancy_ref.num); +} |