Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
theemathas opened this issue Apr 20, 2025 · 2 comments
Closed

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

theemathas opened this issue Apr 20, 2025 · 2 comments
Labels
A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@theemathas
Copy link
Contributor

theemathas commented Apr 20, 2025

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)

@theemathas theemathas added the C-bug Category: This is a bug. label Apr 20, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Apr 20, 2025
@fmease fmease added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. F-lint_reasons `#![feature(lint_reasons)]` and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Apr 20, 2025
@bjorn3
Copy link
Member

bjorn3 commented Apr 20, 2025

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

@fmease
Copy link
Member

fmease commented Apr 20, 2025

Arguably duplicate of #33995

@fmease fmease removed the F-lint_reasons `#![feature(lint_reasons)]` label Apr 20, 2025
@fmease fmease closed this as completed Apr 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants