Closed
Description
Here's a reduced test-case from Firefox source code:
struct Data {
pub field: bool,
}
struct Foo<'a> {
data: &'a mut Data,
}
impl<'a> Foo<'a> {
fn parse_data(&mut self) {
macro_rules! parse {
() => {
self.data.field = true;
}
}
parse!()
}
}
fn main() {
let mut data = Data { field: false };
{
let mut foo = Foo { data: &mut data };
foo.parse_data();
}
println!("{}", data.field);
}
Compiling that program warns with:
warning: field is never read: `data`
--> t.rs:6:5
|
6 | data: &'a mut Data,
| ^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(dead_code)]` on by default
Which is obviously not true.
Meta
rustc --version --verbose
:
rustc 1.51.0-nightly (04caa632d 2021-01-30)
binary: rustc
commit-hash: 04caa632dd10c2bf64b69524c7f9c4c30a436877
commit-date: 2021-01-30
host: x86_64-unknown-linux-gnu
release: 1.51.0-nightly
LLVM version: 11.0.1