summaryrefslogtreecommitdiffstats
path: root/src/test/ui/typeck/assign-non-lval-needs-deref.rs
blob: c979d76b4f4161a90ed637c969528ade1875cc51 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// issue #101376

use std::ops::AddAssign;
struct Foo;

impl AddAssign<()> for Foo {
    fn add_assign(&mut self, _: ()) {}
}

impl AddAssign<()> for &mut Foo {
    fn add_assign(&mut self, _: ()) {}
}

fn main() {
    (&mut Foo) += ();
    //~^ ERROR invalid left-hand side of assignment
    //~| NOTE cannot assign to this expression
    //~| HELP consider dereferencing the left-hand side of this operation
}