]> git.lizzy.rs Git - rust.git/blob - tests/ui/suggestions/shadowed-lplace-method-2.rs
Rollup merge of #107632 - ameknite:issue-107622-fix, r=jyn514
[rust.git] / tests / ui / suggestions / shadowed-lplace-method-2.rs
1 #![allow(unused)]
2
3 struct X {
4     x: (),
5 }
6 pub trait A {
7     fn foo(&mut self, _: usize) -> &mut ();
8 }
9 impl A for X {
10     fn foo(&mut self, _: usize) -> &mut () {
11         &mut self.x
12     }
13 }
14 impl X {
15     fn foo(&mut self, _: usize) -> &mut Self {
16         self
17     }
18 }
19
20 fn main() {
21     let mut x = X { x: () };
22     *x.foo(0) = (); //~ ERROR E0308
23 }