diff options
| author | xFrednet <xFrednet@gmail.com> | 2021-08-06 23:23:34 +0200 |
|---|---|---|
| committer | xFrednet <xFrednet@gmail.com> | 2022-03-02 17:46:06 +0100 |
| commit | f467a58b7bdc330a5af3962df40ad11fe2f05165 (patch) | |
| tree | 04a6f7a18e70f16b85bab3000f7a3f6306ae2871 | |
| parent | 9fef3d9e0a386f8b1e277d4b598e6254c9c0516b (diff) | |
Added `unfulfilled_lint_expectations` lint for (RFC-2383)
| -rw-r--r-- | compiler/rustc_lint_defs/src/builtin.rs | 34 |
1 files changed, 34 insertions, 0 deletions
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 @@ -496,6 +496,39 @@ declare_lint! { } 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, |
