You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Regression when using #[expect(unused)] more than once in an impl block #114416
At some point between rustcnightly-2023-03-05 (works) and nightly-2023-07-01 (does not work) the following stopped compiling:
#![deny(warnings)]structX;implX{#[expect(unused)]fnunused();// This is failing with `warning: this lint expectation is unfulfilled`.// Only the first `#[expect(unused)]` in an impl block works as expected.#[expect(unused)]fnunused2();}fnmain(){let _ = X;}
RUSTFLAGS="-D warnings" cargo check
I have not bisected for the exact commit that broke this.
I have only tried to reproduce this error using #[expect(unused)]. It's possible that this is also broken for other lints.
changed the title [-]Regression when using `#[expect(unused)]` in more than one in an impl block[/-][+]Regression when using `#[expect(unused)]` more than once in an impl block[/+]on Aug 3, 2023
Without properly double-checking this, I'm certain that this regressed in #110277 (merged April 14) which condensed multiple dead_code diagnostics triggered by methods into a single one for readability meddling with the affairs of lint_reasons.
I don't know how lint_reasons is implemented but if it only considers the first primary span of a (buffered) lint diagnostic, then one fix will be changing the relevant part of the code to consider all primary spans.
Activity
[-]Regression when using `#[expect(unused)]` in more than one in an impl block[/-][+]Regression when using `#[expect(unused)]` more than once in an impl block[/+]fmease commentedon Aug 4, 2023
Without properly double-checking this, I'm certain that this regressed in #110277 (merged April 14) which condensed multiple
dead_codediagnostics triggered by methods into a single one for readability meddling with the affairs oflint_reasons.I don't know how
lint_reasonsis implemented but if it only considers the first primary span of a (buffered) lint diagnostic, then one fix will be changing the relevant part of the code to consider all primary spans.@rustbot label T-compiler A-lint F-lint_reasons
Auto merge of rust-lang#114417 - chinedufn:fix-expect-unused-in-impl-…