mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-18 09:53:26 +00:00
add testcase for suggest self
This commit is contained in:
parent
32a2f0dddb
commit
2716449588
@ -13,4 +13,16 @@ impl S {
|
||||
}
|
||||
}
|
||||
|
||||
// https://github.com/rust-lang/rust/pull/103531#discussion_r1004728080
|
||||
struct Foo {
|
||||
i: i32,
|
||||
}
|
||||
|
||||
impl Foo {
|
||||
fn needs_self() {
|
||||
this.i
|
||||
//~^ ERROR cannot find value `this` in this scope
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,3 +1,18 @@
|
||||
error[E0425]: cannot find value `this` in this scope
|
||||
--> $DIR/issue-103474.rs:23:9
|
||||
|
|
||||
LL | this.i
|
||||
| ^^^^ not found in this scope
|
||||
|
|
||||
help: you might have meant to use `self` here instead
|
||||
|
|
||||
LL | self.i
|
||||
| ~~~~
|
||||
help: if you meant to use `self`, you are also missing a `self` receiver argument
|
||||
|
|
||||
LL | fn needs_self(&self) {
|
||||
| +++++
|
||||
|
||||
error[E0425]: cannot find function `first` in this scope
|
||||
--> $DIR/issue-103474.rs:6:9
|
||||
|
|
||||
@ -15,6 +30,6 @@ error[E0425]: cannot find function `no_method_err` in this scope
|
||||
LL | no_method_err()
|
||||
| ^^^^^^^^^^^^^ not found in this scope
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0425`.
|
||||
|
Loading…
Reference in New Issue
Block a user