-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Emit a single error when importing a path with _
#142805
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
Open
estebank
wants to merge
2
commits into
rust-lang:master
Choose a base branch
from
estebank:underscore-import
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+66
−36
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
2 changes: 1 addition & 1 deletion
2
...ple-extern-by-macro-for-underscore.stderr → ...ern-by-macro-for-underscore.ed2015.stderr
This file contains hidden or 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
8 changes: 8 additions & 0 deletions
8
tests/ui/imports/multiple-extern-by-macro-for-underscore.ed2021.stderr
This file contains hidden or 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,8 @@ | ||
error: expected identifier, found reserved identifier `_` | ||
--> $DIR/multiple-extern-by-macro-for-underscore.rs:18:11 | ||
| | ||
LL | use ::_; | ||
| ^ expected identifier, found reserved identifier | ||
|
||
error: aborting due to 1 previous error | ||
|
This file contains hidden or 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 hidden or 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 hidden or 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,39 @@ | ||
error: expected identifier, found reserved identifier `_` | ||
--> $DIR/issue-110164.rs:8:5 | ||
| | ||
LL | use _::a; | ||
| ^ expected identifier, found reserved identifier | ||
|
||
error: expected identifier, found reserved identifier `_` | ||
--> $DIR/issue-110164.rs:10:5 | ||
| | ||
LL | use _::*; | ||
| ^ expected identifier, found reserved identifier | ||
|
||
error: expected identifier, found reserved identifier `_` | ||
--> $DIR/issue-110164.rs:14:9 | ||
| | ||
LL | use _::a; | ||
| ^ expected identifier, found reserved identifier | ||
|
||
error: expected identifier, found reserved identifier `_` | ||
--> $DIR/issue-110164.rs:16:9 | ||
| | ||
LL | use _::*; | ||
| ^ expected identifier, found reserved identifier | ||
|
||
error[E0432]: unresolved import `self::*` | ||
--> $DIR/issue-110164.rs:4:5 | ||
| | ||
LL | use self::*; | ||
| ^^^^^^^ cannot glob-import a module into itself | ||
|
||
error[E0432]: unresolved import `crate::*` | ||
--> $DIR/issue-110164.rs:6:5 | ||
| | ||
LL | use crate::*; | ||
| ^^^^^^^^ cannot glob-import a module into itself | ||
|
||
error: aborting due to 6 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0432`. |
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. Since this pr touches this test, could we also rename it with some more descriptive name and put a small comment with a link on an issue related to this instead? |
This file contains hidden or 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,19 +1,18 @@ | ||
//@ revisions: ed2015 ed2021 | ||
//@[ed2015] edition: 2015 | ||
//@[ed2021] edition: 2021 | ||
use self::*; | ||
//~^ ERROR unresolved import `self::*` | ||
use crate::*; | ||
//~^ ERROR unresolved import `crate::*` | ||
use _::a; | ||
//~^ ERROR expected identifier, found reserved identifier `_` | ||
//~| ERROR unresolved import `_` | ||
use _::*; | ||
//~^ ERROR expected identifier, found reserved identifier `_` | ||
//~| ERROR unresolved import `_` | ||
|
||
fn main() { | ||
use _::a; | ||
//~^ ERROR expected identifier, found reserved identifier `_` | ||
//~| ERROR unresolved import `_` | ||
use _::*; | ||
//~^ ERROR expected identifier, found reserved identifier `_` | ||
//~| ERROR unresolved import `_` | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 leads to inconsistent behavior in code like
use {_, a}
. I'd rather we filter out the errors mentioning_
like we're doing with thaterrors.retain
call above.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.
And while we're at it, we probably should delay a bug in the:
on 691.