rust/tests/ui/crate_in_macro_def.rs

30 lines
540 B
Rust
Raw Normal View History

2022-03-23 20:08:52 -05:00
// run-rustfix
#![warn(clippy::crate_in_macro_def)]
#[macro_use]
mod hygienic {
macro_rules! print_message_hygienic {
() => {
println!("{}", $crate::hygienic::MESSAGE);
};
}
pub const MESSAGE: &str = "Hello!";
}
#[macro_use]
mod unhygienic {
macro_rules! print_message_unhygienic {
() => {
println!("{}", crate::unhygienic::MESSAGE);
};
}
pub const MESSAGE: &str = "Hello!";
}
fn main() {
print_message_hygienic!();
print_message_unhygienic!();
}