-
Notifications
You must be signed in to change notification settings - Fork 13.4k
exclude unexported macro bindings from extern crate #119369
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
Merged
Changes from all commits
Commits
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
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
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,3 @@ | ||
// edition:2018 | ||
|
||
macro_rules! m { () => {}; } |
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 |
---|---|---|
|
@@ -2,3 +2,5 @@ | |
|
||
macro_rules! foo_ { () => {}; } | ||
use foo_ as foo; | ||
|
||
macro_rules! bar { () => {}; } |
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,10 +1,20 @@ | ||
// edition:2018 | ||
// build-pass | ||
// aux-crate:issue_80074=issue-80074-macro.rs | ||
// aux-crate:issue_80074_2=issue-80074-macro-2.rs | ||
|
||
#[macro_use] | ||
extern crate issue_80074; | ||
|
||
#[macro_use(m)] | ||
extern crate issue_80074_2; | ||
//~^^ ERROR: imported macro not found | ||
|
||
fn main() { | ||
foo!(); | ||
//~^ WARN: macro `foo` is private | ||
//~| WARN: it will become a hard error in a future release! | ||
bar!(); | ||
//~^ ERROR: cannot find macro `bar` in this scope | ||
petrochenkov marked this conversation as resolved.
Show resolved
Hide resolved
|
||
m!(); | ||
//~^ ERROR: cannot find macro `m` in this scope | ||
} |
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,31 @@ | ||
error[E0469]: imported macro not found | ||
--> $DIR/issue-80074.rs:8:13 | ||
| | ||
LL | #[macro_use(m)] | ||
| ^ | ||
|
||
error: cannot find macro `bar` in this scope | ||
--> $DIR/issue-80074.rs:16:5 | ||
| | ||
LL | bar!(); | ||
| ^^^ | ||
|
||
error: cannot find macro `m` in this scope | ||
--> $DIR/issue-80074.rs:18:5 | ||
| | ||
LL | m!(); | ||
| ^ | ||
|
||
warning: macro `foo` is private | ||
--> $DIR/issue-80074.rs:13:5 | ||
| | ||
LL | foo!(); | ||
| ^^^ | ||
| | ||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | ||
= note: for more information, see issue #120192 <https://github.com/rust-lang/rust/issues/120192> | ||
= note: `#[warn(private_macro_use)]` on by default | ||
|
||
error: aborting due to 3 previous errors; 1 warning emitted | ||
|
||
For more information about this error, try `rustc --explain E0469`. |
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,2 @@ | ||
use std::vec; | ||
use std::hash::Hash; |
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,14 @@ | ||
// check-pass | ||
// aux-build: issue-119369-extern.rs | ||
|
||
// https://github.com/rust-lang/rust/pull/119369#issuecomment-1874905662 | ||
|
||
#[macro_use] | ||
extern crate issue_119369_extern; | ||
|
||
#[derive(Hash)] | ||
struct A; | ||
|
||
fn main() { | ||
let _: Vec<i32> = vec![]; | ||
} |
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.