forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#119369 - bvanjoi:fix-119301, r=<try>
exclude unexported macro bindings from extern crate Fixes rust-lang#119301 Macros that aren't exported from an external crate should not be defined. r? `@petrochenkov`
- Loading branch information
Showing
5 changed files
with
44 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// edition:2018 | ||
|
||
macro_rules! boo { () => {}; } |
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,19 @@ | ||
// 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(boo)] | ||
extern crate issue_80074_2; | ||
//~^^ ERROR: imported macro not found | ||
|
||
fn main() { | ||
foo!(); | ||
//~^ ERROR: cannot find macro `foo` in this scope | ||
bar!(); | ||
//~^ ERROR: cannot find macro `bar` in this scope | ||
boo!(); | ||
//~^ ERROR: cannot find macro `boo` 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,27 @@ | ||
error[E0469]: imported macro not found | ||
--> $DIR/issue-80074.rs:8:13 | ||
| | ||
LL | #[macro_use(boo)] | ||
| ^^^ | ||
|
||
error: cannot find macro `boo` in this scope | ||
--> $DIR/issue-80074.rs:17:5 | ||
| | ||
LL | boo!(); | ||
| ^^^ | ||
|
||
error: cannot find macro `bar` in this scope | ||
--> $DIR/issue-80074.rs:15:5 | ||
| | ||
LL | bar!(); | ||
| ^^^ | ||
|
||
error: cannot find macro `foo` in this scope | ||
--> $DIR/issue-80074.rs:13:5 | ||
| | ||
LL | foo!(); | ||
| ^^^ | ||
|
||
error: aborting due to 4 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0469`. |