Closed
Description
I tried this code:
fn main() {
print!("hi");
}
macro_rules! print {
($t: expr) => {
println!("{}", $t);
};
}
I expected to see this happen: no errors/warnings
Instead, this happened: unused macro definition: print
#[warn(unused_macros)]
on by default. NOTE: this only occurs when the macro is defined after usage.
Meta
rustc --version --verbose
:
binary: rustc
commit-hash: 4b91a6ea7258a947e59c6522cd5898e7c0a6a88f
commit-date: 2022-08-08
host: aarch64-apple-darwin
release: 1.63.0
LLVM version: 14.0.5
Backtrace
--> src/main.rs:5:14
|
5 | macro_rules! print {
| ^^^^^
|
= note: `#[warn(unused_macros)]` on by default
warning: `learn_test` (bin "learn_test") generated 1 warning