]> git.lizzy.rs Git - rust.git/blob - tests/ui/typeck/assign-non-lval-needs-deref.rs
Rollup merge of #106788 - estebank:elaborate_pred_E0599, r=compiler-errors
[rust.git] / tests / 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 }