Skip to content

Regression when using #[expect(unused)] more than once in an impl block #114416

Closed
@chinedufn

Description

@chinedufn

At some point between rustc nightly-2023-03-05 (works) and nightly-2023-07-01 (does not work) the following stopped compiling:

#![deny(warnings)]

struct X;
impl X {
    #[expect(unused)]
    fn unused();

    // This is failing with `warning: this lint expectation is unfulfilled`.
    // Only the first `#[expect(unused)]` in an impl block works as expected.
    #[expect(unused)]
    fn unused2();
}

fn main() {
    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.

PR: #114417

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.F-lint_reasons`#![feature(lint_reasons)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions