summaryrefslogtreecommitdiffstats
path: root/tests/ui/suggestions/shadowed-lplace-method-2.rs
blob: dab99fbacd9e681b59e7eb97427bd0f4fca3f743 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#![allow(unused)]

struct X {
    x: (),
}
pub trait A {
    fn foo(&mut self, _: usize) -> &mut ();
}
impl A for X {
    fn foo(&mut self, _: usize) -> &mut () {
        &mut self.x
    }
}
impl X {
    fn foo(&mut self, _: usize) -> &mut Self {
        self
    }
}

fn main() {
    let mut x = X { x: () };
    *x.foo(0) = (); //~ ERROR E0308
}