Closed
Description
#![no_std]
macro_rules! foo {
($e:expr) => {
$crate::core::assert!($e);
$crate::core::assert_eq!($e, true);
};
}
pub fn foo() { foo!(true); }
Compiling the above code generates this error message:
error[E0433]: failed to resolve. Could not find `assert` in `core`
--> src/lib.rs:5:23
|
5 | $crate::core::assert!($e);
| ^^^^^^ Could not find `assert` in `core`
...
13 | foo!(true);
| ----------- in this macro invocation
However, this compiles:
#![no_std]
macro_rules! foo {
($e:expr) => {
assert!($e); // no more `$crate::core::` path prefix!
$crate::core::assert_eq!($e, true);
};
}
pub fn foo() { foo!(true); }
Note that for the assert_eq
invokation both versions $crate::core::assert_eq!
and just assert_eq!
works.
Is this intended behaviour or a bug?
Try it yourself at the playground.
Metadata
Metadata
Assignees
Labels
Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Category: This is a bug.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.Relevant to the language teamRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.