-
Notifications
You must be signed in to change notification settings - Fork 14.1k
diagnostics: suggest changing s@self::{macro}@::macro for exported
#104347
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
Merged
bors
merged 4 commits into
rust-lang:master
from
notriddle:notriddle/import-macro-from-self-fixup
Jan 21, 2023
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
e9d8d23
diagnostics: suggest changing `s@self::{macro}@::macro` for exported
notriddle e237690
diagnostics: add `};` only if `{` was added too
notriddle dca160a
diagnostics: use `module_path` to check crate import instead of strings
notriddle c07a722
diagnostics: remvoe unnecessary use of `source_map.start_point`
notriddle 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
diagnostics: add
}; only if { was added too
- Loading branch information
commit e237690a28f0d38ab478616fe4b247fb6eb8013f
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
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,20 @@ | ||
| // run-rustfix | ||
| #![allow(unused, nonstandard_style)] | ||
| mod m { | ||
|
|
||
| mod p { | ||
| #[macro_export] | ||
| macro_rules! nu { | ||
| {} => {}; | ||
| } | ||
|
|
||
| pub struct other_item; | ||
| } | ||
|
|
||
| use ::nu; | ||
| pub use self::p::{other_item as _}; | ||
| //~^ ERROR unresolved import `self::p::nu` [E0432] | ||
| //~| HELP a macro with this name exists at the root of the crate | ||
| } | ||
|
|
||
| fn main() {} |
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,19 @@ | ||
| // run-rustfix | ||
| #![allow(unused, nonstandard_style)] | ||
| mod m { | ||
|
|
||
| mod p { | ||
| #[macro_export] | ||
| macro_rules! nu { | ||
| {} => {}; | ||
| } | ||
|
|
||
| pub struct other_item; | ||
| } | ||
|
|
||
| pub use self::p::{nu, other_item as _}; | ||
| //~^ ERROR unresolved import `self::p::nu` [E0432] | ||
| //~| HELP a macro with this name exists at the root of the crate | ||
| } | ||
|
|
||
| fn main() {} |
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,16 @@ | ||
| error[E0432]: unresolved import `self::p::nu` | ||
| --> $DIR/issue-99695-b.rs:14:23 | ||
| | | ||
| LL | pub use self::p::{nu, other_item as _}; | ||
| | ^^ no `nu` in `m::p` | ||
| | | ||
| = note: this could be because a macro annotated with `#[macro_export]` will be exported at the root of the crate instead of the module where it is defined | ||
| help: a macro with this name exists at the root of the crate | ||
| | | ||
| LL ~ use ::nu; | ||
| LL ~ pub use self::p::{other_item as _}; | ||
| | | ||
|
|
||
| error: aborting due to previous error | ||
|
|
||
| For more information about this error, try `rustc --explain E0432`. |
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.
Uh oh!
There was an error while loading. Please reload this page.