File tree Expand file tree Collapse file tree 2 files changed +45
-1
lines changed Expand file tree Collapse file tree 2 files changed +45
-1
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,20 @@ struct Foo {
1313}
1414
1515impl Foo {
16+ fn this1 ( & self ) -> i32 {
17+ let this = self ;
18+ let a = 1 ;
19+ this. x
20+ }
21+
22+ fn this2 ( & self ) -> i32 {
23+ let a = Foo {
24+ x : 2
25+ } ;
26+ let this = a;
27+ this. x
28+ }
29+
1630 fn foo ( & self ) -> i32 {
1731 this. x
1832 //~^ ERROR cannot find value `this` in this scope
@@ -25,7 +39,7 @@ impl Foo {
2539
2640 fn baz ( & self ) -> i32 {
2741 my. bar ( )
28- //~^ ERROR cannot find value `this ` in this scope
42+ //~^ ERROR cannot find value `my ` in this scope
2943 }
3044}
3145
Original file line number Diff line number Diff line change 1+ error[E0425]: cannot find value `this` in this scope
2+ --> $DIR/suggest-self.rs:31:9
3+ |
4+ LL | this.x
5+ | ^^^^
6+ | |
7+ | not found in this scope
8+ | help: do you mean: `self`
9+
10+ error[E0425]: cannot find value `this` in this scope
11+ --> $DIR/suggest-self.rs:36:9
12+ |
13+ LL | this.foo()
14+ | ^^^^
15+ | |
16+ | not found in this scope
17+ | help: do you mean: `self`
18+
19+ error[E0425]: cannot find value `my` in this scope
20+ --> $DIR/suggest-self.rs:41:9
21+ |
22+ LL | my.bar()
23+ | ^^
24+ | |
25+ | not found in this scope
26+ | help: do you mean: `self`
27+
28+ error: aborting due to 3 previous errors
29+
30+ For more information about this error, try `rustc --explain E0425`.
You can’t perform that action at this time.
0 commit comments