Closed
Description
I see no reason why the following code shouldn't work on the latest nightly,
#![feature(decl_macro)]
macro foo($mod_name:ident) {
pub mod $mod_name {
pub const BAR: u32 = 1;
}
}
foo!(foo_mod);
fn main() {
println!("{}", foo_mod::BAR);
}
yet I get an odd error.
error[E0425]: cannot find value `BAR` in module `FooMod`
--> src/main.rs:12:25
|
12 | println!("{}", FooMod::BAR);
| ^^^ not found in `FooMod`
help: possible candidate is found in another module, you can import it into scope
|
3 | use FooMod::BAR;
|
error: aborting due to previous error
Perhaps I'm missing something about how hygiene works in macros 2.0?
Metadata
Metadata
Assignees
Labels
No labels