Skip to content

Commit 081e32b

Browse files
committed
Add test for issue-58490
1 parent 54b7d21 commit 081e32b

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

src/test/ui/macros/issue-58490.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Regression test for #58490
2+
3+
macro_rules! a {
4+
( @1 $i:item ) => {
5+
a! { @2 $i }
6+
};
7+
( @2 $i:item ) => {
8+
$i
9+
};
10+
}
11+
mod b {
12+
a! {
13+
@1
14+
#[macro_export]
15+
macro_rules! b { () => () }
16+
}
17+
#[macro_export]
18+
macro_rules! b { () => () }
19+
//~^ ERROR: the name `b` is defined multiple times
20+
}
21+
mod c {
22+
#[allow(unused_imports)]
23+
use crate::b;
24+
}
25+
26+
fn main() {}

src/test/ui/macros/issue-58490.stderr

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error[E0428]: the name `b` is defined multiple times
2+
--> $DIR/issue-58490.rs:18:5
3+
|
4+
LL | macro_rules! b { () => () }
5+
| -------------- previous definition of the macro `b` here
6+
...
7+
LL | macro_rules! b { () => () }
8+
| ^^^^^^^^^^^^^^ `b` redefined here
9+
|
10+
= note: `b` must be defined only once in the macro namespace of this module
11+
12+
error: aborting due to previous error
13+
14+
For more information about this error, try `rustc --explain E0428`.

0 commit comments

Comments
 (0)