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:
David Wood 2019-04-07 17:56:50 +02:00
parent 4fb888bf04
commit 126ac9ef6c
No known key found for this signature in database
GPG key ID: 01760B4F9F53F154
3 changed files with 46 additions and 0 deletions

View file

@ -0,0 +1,8 @@
pub mod foo {
#[macro_export]
macro_rules! makro {
($foo:ident) => {
fn $foo() { }
}
}
}

View 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]
}

View 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`.