Skip to content

#[expect] does not work on arguments of trait methods and fn pointers #140088

Closed as duplicate of#33995
@theemathas

Description

@theemathas

I tried this code:

pub trait Trait {
    fn foo(#[expect(while_true)] x: i32);
}

pub fn bar() {
    let _: fn(#[expect(while_true)] y: i32);
}

I expected to get two unfulfilled_lint_expectations warnings due to the #[expect] attribute. Instead, the code compiles with no warnings.

See also #140087 and #140089

Meta

Issue reproduces on the playground with version 1.88.0-nightly (2025-04-07 e643f59f6da3a84f43e7)

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.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