Skip to content

Commit 126ac9e

Browse files
committed
Add test with current behaviour.
This commit adds a test demonstrating the current behaviour when a macro defined in a module with the `#[macro_export]` is imported from the module rather than the crate root.
1 parent 4fb888b commit 126ac9e

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed

src/test/ui/auxiliary/issue-59764.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
pub mod foo {
2+
#[macro_export]
3+
macro_rules! makro {
4+
($foo:ident) => {
5+
fn $foo() { }
6+
}
7+
}
8+
}

src/test/ui/issue-59764.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// aux-build:issue-59764.rs
2+
// compile-flags:--extern issue_59764
3+
// edition:2018
4+
5+
use issue_59764::foo::makro;
6+
//~^ ERROR unresolved import `issue_59764::foo::makro` [E0432]
7+
8+
makro!(bar);
9+
//~^ ERROR cannot determine resolution for the macro `makro`
10+
11+
fn main() {
12+
bar();
13+
//~^ ERROR cannot find function `bar` in this scope [E0425]
14+
}

src/test/ui/issue-59764.stderr

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
error[E0432]: unresolved import `issue_59764::foo::makro`
2+
--> $DIR/issue-59764.rs:5:5
3+
|
4+
LL | use issue_59764::foo::makro;
5+
| ^^^^^^^^^^^^^^^^^^^^^^^ no `makro` in `foo`
6+
7+
error: cannot determine resolution for the macro `makro`
8+
--> $DIR/issue-59764.rs:8:1
9+
|
10+
LL | makro!(bar);
11+
| ^^^^^
12+
|
13+
= note: import resolution is stuck, try simplifying macro imports
14+
15+
error[E0425]: cannot find function `bar` in this scope
16+
--> $DIR/issue-59764.rs:12:5
17+
|
18+
LL | bar();
19+
| ^^^ not found in this scope
20+
21+
error: aborting due to 3 previous errors
22+
23+
Some errors occurred: E0425, E0432.
24+
For more information about an error, try `rustc --explain E0425`.

0 commit comments

Comments
 (0)