Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit f467a58

Browse files
committed
Added unfulfilled_lint_expectations lint for (RFC-2383)
1 parent 9fef3d9 commit f467a58

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

compiler/rustc_lint_defs/src/builtin.rs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,39 @@ declare_lint! {
495495
"unrecognized lint attribute"
496496
}
497497

498+
declare_lint! {
499+
/// The `unfulfilled_lint_expectations` lint detects lint trigger expectations
500+
/// that have not been fulfilled.
501+
///
502+
/// ### Example
503+
///
504+
/// ```rust
505+
/// #![feature(lint_reasons)]
506+
///
507+
/// #[expect(unused_variables)]
508+
/// let x = 10;
509+
/// println!("{}", x);
510+
/// ```
511+
///
512+
/// {{produces}}
513+
///
514+
/// ### Explanation
515+
///
516+
/// It was expected that the marked code would emit a lint. This expectation
517+
/// has not been fulfilled.
518+
///
519+
/// The `expect` attribute can be removed if this is intended behavior otherwise
520+
/// it should be investigated why the expected lint is no longer issued.
521+
///
522+
/// Part of RFC 2383. The progress is being tracked in [#54503]
523+
///
524+
/// [#54503]: https://github.com/rust-lang/rust/issues/54503
525+
pub UNFULFILLED_LINT_EXPECTATIONS,
526+
Warn,
527+
"unfulfilled lint expectation",
528+
@feature_gate = rustc_span::sym::lint_reasons;
529+
}
530+
498531
declare_lint! {
499532
/// The `unused_variables` lint detects variables which are not used in
500533
/// any way.
@@ -3007,6 +3040,7 @@ declare_lint_pass! {
30073040
UNUSED_CRATE_DEPENDENCIES,
30083041
UNUSED_QUALIFICATIONS,
30093042
UNKNOWN_LINTS,
3043+
UNFULFILLED_LINT_EXPECTATIONS,
30103044
UNUSED_VARIABLES,
30113045
UNUSED_ASSIGNMENTS,
30123046
DEAD_CODE,

0 commit comments

Comments
 (0)