File tree 2 files changed +45
-1
lines changed
2 files changed +45
-1
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,20 @@ struct Foo {
13
13
}
14
14
15
15
impl 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
+
16
30
fn foo ( & self ) -> i32 {
17
31
this. x
18
32
//~^ ERROR cannot find value `this` in this scope
@@ -25,7 +39,7 @@ impl Foo {
25
39
26
40
fn baz ( & self ) -> i32 {
27
41
my. bar ( )
28
- //~^ ERROR cannot find value `this ` in this scope
42
+ //~^ ERROR cannot find value `my ` in this scope
29
43
}
30
44
}
31
45
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