]> git.proxmox.com Git - rustc.git/blob - src/test/ui/typeck/assign-non-lval-needs-deref.rs
New upstream version 1.65.0+dfsg1
[rustc.git] / src / test / ui / typeck / assign-non-lval-needs-deref.rs
1 // issue #101376
2
3 use std::ops::AddAssign;
4 struct Foo;
5
6 impl AddAssign<()> for Foo {
7 fn add_assign(&mut self, _: ()) {}
8 }
9
10 impl AddAssign<()> for &mut Foo {
11 fn add_assign(&mut self, _: ()) {}
12 }
13
14 fn main() {
15 (&mut Foo) += ();
16 //~^ ERROR invalid left-hand side of assignment
17 //~| NOTE cannot assign to this expression
18 //~| HELP consider dereferencing the left-hand side of this operation
19 }