I tried this code:
#[macro_export]
macro_rules! owo {
() => {};
}
mod m {
use crate::owo;
owo!();
}
On stable, cargo check completes successfully. On Nightly, it produces a warning:
warning: unused import: `crate::owo`
--> src/lib.rs:6:9
|
6 | use crate::owo;
| ^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default
Nightly is correct in the sense that the import is, in fact, unnecessary, and the code builds with or without it. But I’m not sure whether this is a bug or not. I always put the import in because I like to think about modules and don’t like to think about the arcane macro_rules! scoping rules, but given that I can’t disable those rules this might be a losing battle…
Meta
rustc --version --verbose:
rustc 1.90.0 (1159e78c4 2025-09-14)
binary: rustc
commit-hash: 1159e78c4747b02ef996e55082b704c09b970588
commit-date: 2025-09-14
host: x86_64-unknown-linux-gnu
release: 1.90.0
LLVM version: 20.1.8
rustc +nightly --version --verbose:
rustc 1.92.0-nightly (53a741fc4 2025-10-16)
binary: rustc
commit-hash: 53a741fc4b8cf2d8e7b1b2336ed8edf889db84f4
commit-date: 2025-10-16
host: x86_64-unknown-linux-gnu
release: 1.92.0-nightly
LLVM version: 21.1.3
I tried this code:
On stable,
cargo checkcompletes successfully. On Nightly, it produces a warning:Nightly is correct in the sense that the import is, in fact, unnecessary, and the code builds with or without it. But I’m not sure whether this is a bug or not. I always put the import in because I like to think about modules and don’t like to think about the arcane
macro_rules!scoping rules, but given that I can’t disable those rules this might be a losing battle…Meta
rustc --version --verbose:rustc +nightly --version --verbose: