-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Suppress import errors for traits that couldve applied in method look…
…up on error
- Loading branch information
1 parent
f6648f2
commit c3b696d
Showing
4 changed files
with
46 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Test that we don't issue an unused import warning when there's | ||
// a method lookup error and that trait was possibly applicable. | ||
|
||
use foo::Bar; | ||
|
||
mod foo { | ||
pub trait Bar { | ||
fn uwu(&self) {} | ||
} | ||
} | ||
|
||
struct Foo; | ||
|
||
fn main() { | ||
Foo.uwu(); | ||
//~^ ERROR no method named `uwu` found for struct `Foo` in the current scope | ||
} |
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,19 @@ | ||
error[E0599]: no method named `uwu` found for struct `Foo` in the current scope | ||
--> $DIR/unused-trait-with-method-err.rs:15:9 | ||
| | ||
LL | struct Foo; | ||
| ---------- method `uwu` not found for this struct | ||
... | ||
LL | Foo.uwu(); | ||
| ^^^ method not found in `Foo` | ||
| | ||
= help: items from traits can only be used if the trait is implemented and in scope | ||
note: `Bar` defines an item `uwu`, perhaps you need to implement it | ||
--> $DIR/unused-trait-with-method-err.rs:7:5 | ||
| | ||
LL | pub trait Bar { | ||
| ^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0599`. |