Skip to content
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

Expect doesn't work on struct field #138319

Open
Mark-Simulacrum opened this issue Mar 10, 2025 · 0 comments
Open

Expect doesn't work on struct field #138319

Mark-Simulacrum opened this issue Mar 10, 2025 · 0 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Mark-Simulacrum
Copy link
Member

Code

fn _foo() {
    Bar {
        #[expect(deprecated)]
        foo: 0,
    };
}

struct Bar {
    #[deprecated = "reason"]
    foo: u32,
}

Current output

warning: use of deprecated field `Bar::foo`: reason
 --> src/lib.rs:4:9
  |
4 |         foo: 0,
  |         ^^^^^^
  |
  = note: `#[warn(deprecated)]` on by default

warning: this lint expectation is unfulfilled
 --> src/lib.rs:3:18
  |
3 |         #[expect(deprecated)]
  |                  ^^^^^^^^^^
  |
  = note: `#[warn(unfulfilled_lint_expectations)]` on by default

Desired output

n/a (empty)

Rationale and extra context

Expectation should be fulfilled, as the deprecated lint is actively being emitted from that field initialization. This works as expected if the expectation is moved elsewhere (e.g., to the function).

Other cases

Rust Version

Current stable (1.85)

Anything else?

No response

@Mark-Simulacrum Mark-Simulacrum added A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints 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

1 participant