]> git.lizzy.rs Git - rust.git/blob - src/test/ui/self/suggest-self.rs
Update ui tests
[rust.git] / src / test / ui / self / suggest-self.rs
1 struct Foo {
2     x: i32,
3 }
4
5 impl Foo {
6     fn this1(&self) -> i32 {
7         let this = self;
8         let a = 1;
9         this.x
10     }
11
12     fn this2(&self) -> i32 {
13         let a = Foo {
14             x: 2
15         };
16         let this = a;
17         this.x
18     }
19
20     fn foo(&self) -> i32 {
21         this.x
22         //~^ ERROR cannot find value `this` in this scope
23     }
24
25     fn bar(&self) -> i32 {
26         this.foo()
27         //~^ ERROR cannot find value `this` in this scope
28     }
29
30     fn baz(&self) -> i32 {
31         my.bar()
32         //~^ ERROR cannot find value `my` in this scope
33     }
34 }
35
36 fn main() {
37     let this = vec![1, 2, 3];
38     let my = vec![1, 2, 3];
39     let len = this.len();
40     let len = my.len();
41 }