Closed dtolnay closed 5 years ago
Hmm, looks like there are some changes to how warnings are surfaced in external macros in a recent nightly? As an example, in a quick local test I've got a binary main
that depends on a library lib
. Both define a macro containing dead code, but only the local macro actually raises a warning:
// lib/lib.rs
#[macro_export]
macro_rules! lib_make_unused {
() => { static LIB_UNUSED: () = (); }
}
// main/main.rs
#[macro_use]
extern crate lib;
macro_rules! make_unused {
() => { static UNUSED: () = (); }
}
lib_make_unused! {}
make_unused! {}
fn main() { }
Which on my (fairly recent) nightly rustc 1.29.0-nightly (97085f9fb 2018-08-01)
results in:
warning: static item is never used: `UNUSED`
--> src/main.rs:5:13
|
5 | () => { static UNUSED: () = (); }
| ^^^^^^^^^^^^^^^^^^^^^^^
...
9 | make_unused! {}
| --------------- in this macro invocation
I'm wondering if it's really worth keeping this compile test since it's only dealing with a warn-by-default lint anyway.
Ok I've gone ahead and removed this test so folks have a green build to work with, but thought we could leave this issue open until we decide whether we want to find a way to restore the previous behaviour.
One of our compile-fail test cases is no longer failing to compile.