Skip to content

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

Closed as duplicate

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)

Activity

  1. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Apr 20, 2025
  2. added
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.
    and removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Apr 20, 2025
  3. bjorn3 commented on Apr 20, 2025

    @bjorn3
    Member

    I think lint level attributes are just not supported in that location at all.

  4. fmease commented on Apr 20, 2025

    @fmease
    Member

    Arguably duplicate of #33995

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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