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.
This commit is contained in:
parent
4fb888bf04
commit
126ac9ef6c
3 changed files with 46 additions and 0 deletions
8
src/test/ui/auxiliary/issue-59764.rs
Normal file
8
src/test/ui/auxiliary/issue-59764.rs
Normal file
|
@ -0,0 +1,8 @@
|
|||
pub mod foo {
|
||||
#[macro_export]
|
||||
macro_rules! makro {
|
||||
($foo:ident) => {
|
||||
fn $foo() { }
|
||||
}
|
||||
}
|
||||
}
|
14
src/test/ui/issue-59764.rs
Normal file
14
src/test/ui/issue-59764.rs
Normal file
|
@ -0,0 +1,14 @@
|
|||
// aux-build:issue-59764.rs
|
||||
// compile-flags:--extern issue_59764
|
||||
// edition:2018
|
||||
|
||||
use issue_59764::foo::makro;
|
||||
//~^ ERROR unresolved import `issue_59764::foo::makro` [E0432]
|
||||
|
||||
makro!(bar);
|
||||
//~^ ERROR cannot determine resolution for the macro `makro`
|
||||
|
||||
fn main() {
|
||||
bar();
|
||||
//~^ ERROR cannot find function `bar` in this scope [E0425]
|
||||
}
|
24
src/test/ui/issue-59764.stderr
Normal file
24
src/test/ui/issue-59764.stderr
Normal file
|
@ -0,0 +1,24 @@
|
|||
error[E0432]: unresolved import `issue_59764::foo::makro`
|
||||
--> $DIR/issue-59764.rs:5:5
|
||||
|
|
||||
LL | use issue_59764::foo::makro;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ no `makro` in `foo`
|
||||
|
||||
error: cannot determine resolution for the macro `makro`
|
||||
--> $DIR/issue-59764.rs:8:1
|
||||
|
|
||||
LL | makro!(bar);
|
||||
| ^^^^^
|
||||
|
|
||||
= note: import resolution is stuck, try simplifying macro imports
|
||||
|
||||
error[E0425]: cannot find function `bar` in this scope
|
||||
--> $DIR/issue-59764.rs:12:5
|
||||
|
|
||||
LL | bar();
|
||||
| ^^^ not found in this scope
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
Some errors occurred: E0425, E0432.
|
||||
For more information about an error, try `rustc --explain E0425`.
|
Loading…
Add table
Reference in a new issue