diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs index adec1a3ab00..272913f3f0e 100644 --- a/compiler/rustc_lint_defs/src/builtin.rs +++ b/compiler/rustc_lint_defs/src/builtin.rs @@ -495,6 +495,39 @@ declare_lint! { "unrecognized lint attribute" } +declare_lint! { + /// The `unfulfilled_lint_expectations` lint detects lint trigger expectations + /// that have not been fulfilled. + /// + /// ### Example + /// + /// ```rust + /// #![feature(lint_reasons)] + /// + /// #[expect(unused_variables)] + /// let x = 10; + /// println!("{}", x); + /// ``` + /// + /// {{produces}} + /// + /// ### Explanation + /// + /// It was expected that the marked code would emit a lint. This expectation + /// has not been fulfilled. + /// + /// The `expect` attribute can be removed if this is intended behavior otherwise + /// it should be investigated why the expected lint is no longer issued. + /// + /// Part of RFC 2383. The progress is being tracked in [#54503] + /// + /// [#54503]: https://github.com/rust-lang/rust/issues/54503 + pub UNFULFILLED_LINT_EXPECTATIONS, + Warn, + "unfulfilled lint expectation", + @feature_gate = rustc_span::sym::lint_reasons; +} + declare_lint! { /// The `unused_variables` lint detects variables which are not used in /// any way. @@ -3007,6 +3040,7 @@ declare_lint_pass! { UNUSED_CRATE_DEPENDENCIES, UNUSED_QUALIFICATIONS, UNKNOWN_LINTS, + UNFULFILLED_LINT_EXPECTATIONS, UNUSED_VARIABLES, UNUSED_ASSIGNMENTS, DEAD_CODE,