-
-
Notifications
You must be signed in to change notification settings - Fork 15.1k
Address redundant errors for missing crate for nested imports and later uses of crate #153956
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,10 @@ | ||
| #![allow(unused_imports)] | ||
|
|
||
| mod foo {} | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is changing the purpose of the test. Please prefer creating another one. |
||
| use foo::{ | ||
| //~^ ERROR: unresolved import `foo` | ||
| ::bar, | ||
| //~^ ERROR: crate root in paths can only be used in start position | ||
| super::bar, | ||
| //~^ ERROR: `super` in paths can only be used in start position | ||
| self::bar, | ||
| //~^ ERROR: `self` in paths can only be used in start position | ||
| }; | ||
|
|
||
| fn main() {} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,14 @@ | ||
| error[E0433]: the crate root in paths can only be used in start position | ||
| --> $DIR/absolute-paths-in-nested-use-groups.rs:6:5 | ||
| error[E0432]: unresolved import `foo` | ||
| --> $DIR/absolute-paths-in-nested-use-groups.rs:3:5 | ||
| | | ||
| LL | ::bar, | ||
| | ^ can only be used in path start position | ||
|
|
||
| error[E0433]: `super` in paths can only be used in start position | ||
| --> $DIR/absolute-paths-in-nested-use-groups.rs:8:5 | ||
| LL | use foo::{ | ||
| | ^^^ use of unresolved module or unlinked crate `foo` | ||
| | | ||
| LL | super::bar, | ||
| | ^^^^^ can only be used in path start position | ||
|
|
||
| error[E0433]: `self` in paths can only be used in start position | ||
| --> $DIR/absolute-paths-in-nested-use-groups.rs:10:5 | ||
| help: you might be missing a crate named `foo`, add it to your project and import it in your code | ||
| | | ||
| LL + extern crate foo; | ||
| | | ||
| LL | self::bar, | ||
| | ^^^^ can only be used in path start position | ||
|
|
||
| error: aborting due to 3 previous errors | ||
| error: aborting due to 1 previous error | ||
|
|
||
| For more information about this error, try `rustc --explain E0433`. | ||
| For more information about this error, try `rustc --explain E0432`. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,11 +3,11 @@ | |
| // caused by `{{root}}` appearing in diagnostic suggestions | ||
|
|
||
| mod A { | ||
| use Iuse::{ ::Fish }; //~ ERROR cannot find module or crate `Iuse` in the crate root | ||
| use Iuse::{ ::Fish }; //~ ERROR unresolved import `Iuse` | ||
| } | ||
|
|
||
| mod B { | ||
| use A::{::Fish}; //~ ERROR the crate root in paths can only be used in start position | ||
| use A::{::Fish}; //~ ERROR unresolved import `A::Fish` | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hello. This is an unwanted regression in diagnostics, isn't it? In case you haven't looked through all diagnostic output changes and made sure they are all sensible, please do that. Thanks! |
||
| } | ||
|
|
||
| fn main() {} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| // Issue #153156: Too many errors for missing crate for nested imports and later uses | ||
|
|
||
| use foo::{bar, baz::bat}; | ||
| //~^ ERROR unresolved import `foo` | ||
|
|
||
| pub fn main() { | ||
| foo::qux(); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| error[E0432]: unresolved import `foo` | ||
| --> $DIR/redundant-import-errors-nested.rs:3:5 | ||
| | | ||
| LL | use foo::{bar, baz::bat}; | ||
| | ^^^ use of unresolved module or unlinked crate `foo` | ||
| | | ||
| help: you might be missing a crate named `foo`, add it to your project and import it in your code | ||
| | | ||
| LL + extern crate foo; | ||
| | | ||
|
|
||
| error: aborting due to 1 previous error | ||
|
|
||
| For more information about this error, try `rustc --explain E0432`. |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may be sufficient for a single-file test case. What if the prefix exists in one file and not another one?
View changes since the review