forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
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 rust-lang#64265 - petrochenkov:useerr, r=estebank
resolve: Mark more erroneous imports as used Fixes rust-lang#63724 r? @estebank
- Loading branch information
Showing
3 changed files
with
37 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,18 @@ | ||
// There should be *no* unused import errors. | ||
// There should be *one* unused import error. | ||
#![deny(unused_imports)] | ||
|
||
mod qux { | ||
fn quz() {} | ||
pub fn quy() {} | ||
} | ||
|
||
use qux::quz; //~ ERROR function `quz` is private | ||
use qux::bar; //~ ERROR unresolved import `qux::bar` | ||
use foo::bar; //~ ERROR unresolved import `foo` | ||
use qux::quz; //~ ERROR function `quz` is private | ||
use qux::bar; //~ ERROR unresolved import `qux::bar` | ||
use foo::bar; | ||
use baz::*; | ||
use qux::bar2; //~ ERROR unresolved import `qux::bar2` | ||
use foo2::bar2; | ||
use baz2::*; | ||
use qux::quy; //~ ERROR unused import | ||
|
||
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 |
---|---|---|
@@ -1,22 +1,34 @@ | ||
error[E0432]: unresolved import `qux::bar` | ||
--> $DIR/unresolved-imports-used.rs:9:5 | ||
--> $DIR/unresolved-imports-used.rs:10:5 | ||
| | ||
LL | use qux::bar; | ||
| ^^^^^^^^ no `bar` in `qux` | ||
|
||
error[E0432]: unresolved import `foo` | ||
--> $DIR/unresolved-imports-used.rs:10:5 | ||
error[E0432]: unresolved import `qux::bar2` | ||
--> $DIR/unresolved-imports-used.rs:13:5 | ||
| | ||
LL | use foo::bar; | ||
| ^^^ maybe a missing crate `foo`? | ||
LL | use qux::bar2; | ||
| ^^^^^^^^^ no `bar2` in `qux` | ||
|
||
error[E0603]: function `quz` is private | ||
--> $DIR/unresolved-imports-used.rs:8:10 | ||
--> $DIR/unresolved-imports-used.rs:9:10 | ||
| | ||
LL | use qux::quz; | ||
| ^^^ | ||
|
||
error: aborting due to 3 previous errors | ||
error: unused import: `qux::quy` | ||
--> $DIR/unresolved-imports-used.rs:16:5 | ||
| | ||
LL | use qux::quy; | ||
| ^^^^^^^^ | ||
| | ||
note: lint level defined here | ||
--> $DIR/unresolved-imports-used.rs:2:9 | ||
| | ||
LL | #![deny(unused_imports)] | ||
| ^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 4 previous errors | ||
|
||
Some errors have detailed explanations: E0432, E0603. | ||
For more information about an error, try `rustc --explain E0432`. |