-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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 #119369 - bvanjoi:fix-119301, r=petrochenkov
exclude unexported macro bindings from extern crate Fixes #119301 Macros that aren't exported from an external crate should not be defined. r? ``@petrochenkov``
- Loading branch information
Showing
12 changed files
with
149 additions
and
17 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
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
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
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// edition:2018 | ||
|
||
macro_rules! m { () => {}; } |
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 |
---|---|---|
|
@@ -2,3 +2,5 @@ | |
|
||
macro_rules! foo_ { () => {}; } | ||
use foo_ as foo; | ||
|
||
macro_rules! bar { () => {}; } |
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,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 | ||
m!(); | ||
//~^ ERROR: cannot find macro `m` in this scope | ||
} |
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 |
---|---|---|
@@ -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 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 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![]; | ||
} |