Add test for issue-58490

This commit is contained in:
Yuki Okushi 2020-03-13 09:03:30 +09:00
parent 54b7d21f59
commit 081e32baba
No known key found for this signature in database
GPG Key ID: B0986C85C0E2DAA1
2 changed files with 40 additions and 0 deletions

View File

@ -0,0 +1,26 @@
// Regression test for #58490
macro_rules! a {
( @1 $i:item ) => {
a! { @2 $i }
};
( @2 $i:item ) => {
$i
};
}
mod b {
a! {
@1
#[macro_export]
macro_rules! b { () => () }
}
#[macro_export]
macro_rules! b { () => () }
//~^ ERROR: the name `b` is defined multiple times
}
mod c {
#[allow(unused_imports)]
use crate::b;
}
fn main() {}

View File

@ -0,0 +1,14 @@
error[E0428]: the name `b` is defined multiple times
--> $DIR/issue-58490.rs:18:5
|
LL | macro_rules! b { () => () }
| -------------- previous definition of the macro `b` here
...
LL | macro_rules! b { () => () }
| ^^^^^^^^^^^^^^ `b` redefined here
|
= note: `b` must be defined only once in the macro namespace of this module
error: aborting due to previous error
For more information about this error, try `rustc --explain E0428`.