-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
suggestion if struct field has method
- Loading branch information
1 parent
18f314e
commit dff7f25
Showing
6 changed files
with
113 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
struct Kind; | ||
|
||
struct Ty { | ||
kind: Kind, | ||
} | ||
|
||
impl Ty { | ||
fn kind(&self) -> Kind { | ||
todo!() | ||
} | ||
} | ||
|
||
struct InferOk<T> { | ||
value: T, | ||
predicates: Vec<()>, | ||
} | ||
|
||
fn foo(i: InferOk<Ty>) { | ||
let k = i.kind(); | ||
//~^ no method named `kind` found for struct `InferOk` in the current scope | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
error[E0599]: no method named `kind` found for struct `InferOk` in the current scope | ||
--> $DIR/field-has-method.rs:19:15 | ||
| | ||
LL | struct InferOk<T> { | ||
| ----------------- method `kind` not found for this | ||
... | ||
LL | let k = i.kind(); | ||
| ^^^^ method not found in `InferOk<Ty>` | ||
| | ||
help: one of the expressions' fields has a method of the same name | ||
| | ||
LL | let k = i.value.kind(); | ||
| ++++++ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0599`. |