-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #131702 - compiler-errors:method-lookup-trait-warning…
…, r=jieyouxu Suppress import errors for traits that couldve applied for method lookup error Self-explanatory. I hit this quite often when refactoring in rustc, so even though this isn't really showing up as significant in the UI test suite, it probably will matter more for multi-module projects.
- Loading branch information
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`. |