//! compiler code, rather than using their own custom pass. Those
//! lints are all available in `rustc_lint::builtin`.
+// ignore-tidy-filelength
+
use crate::{declare_lint, declare_lint_pass};
use rustc_span::edition::Edition;
use rustc_span::symbol::sym;
+declare_lint! {
+ /// The `forbidden_lint_groups` lint detects violations of
+ /// `forbid` applied to a lint group. Due to a bug in the compiler,
+ /// these used to be overlooked entirely. They now generate a warning.
+ ///
+ /// ### Example
+ ///
+ /// ```rust
+ /// #![forbid(warnings)]
+ /// #![deny(bad_style)]
+ ///
+ /// fn main() {}
+ /// ```
+ ///
+ /// {{produces}}
+ ///
+ /// ### Recommended fix
+ ///
+ /// If your crate is using `#![forbid(warnings)]`,
+ /// we recommend that you change to `#![deny(warnings)]`.
+ ///
+ /// ### Explanation
+ ///
+ /// Due to a compiler bug, applying `forbid` to lint groups
+ /// previously had no effect. The bug is now fixed but instead of
+ /// enforcing `forbid` we issue this future-compatibility warning
+ /// to avoid breaking existing crates.
+ pub FORBIDDEN_LINT_GROUPS,
+ Warn,
+ "applying forbid to lint-groups",
+ @future_incompatible = FutureIncompatibleInfo {
+ reference: "issue #81670 <https://github.com/rust-lang/rust/issues/81670>",
+ edition: None,
+ };
+}
+
declare_lint! {
/// The `ill_formed_attribute_input` lint detects ill-formed attribute
/// inputs that were previously accepted and used in practice.
pub CONST_ERR,
Deny,
"constant evaluation encountered erroneous expression",
+ @future_incompatible = FutureIncompatibleInfo {
+ reference: "issue #71800 <https://github.com/rust-lang/rust/issues/71800>",
+ edition: None,
+ };
report_in_external_macro
}
/// Does nothing as a lint pass, but registers some `Lint`s
/// that are used by other parts of the compiler.
HardwiredLints => [
+ FORBIDDEN_LINT_GROUPS,
ILLEGAL_FLOATING_POINT_LITERAL_PATTERN,
ARITHMETIC_OVERFLOW,
UNCONDITIONAL_PANIC,
UNSUPPORTED_NAKED_FUNCTIONS,
MISSING_ABI,
SEMICOLON_IN_EXPRESSIONS_FROM_MACROS,
+ DISJOINT_CAPTURE_DROP_REORDER,
]
}
"detects doc comments that aren't used by rustdoc"
}
+declare_lint! {
+ /// The `disjoint_capture_drop_reorder` lint detects variables that aren't completely
+ /// captured when the feature `capture_disjoint_fields` is enabled and it affects the Drop
+ /// order of at least one path starting at this variable.
+ ///
+ /// ### Example
+ ///
+ /// ```rust,compile_fail
+ /// # #![deny(disjoint_capture_drop_reorder)]
+ /// # #![allow(unused)]
+ /// struct FancyInteger(i32);
+ ///
+ /// impl Drop for FancyInteger {
+ /// fn drop(&mut self) {
+ /// println!("Just dropped {}", self.0);
+ /// }
+ /// }
+ ///
+ /// struct Point { x: FancyInteger, y: FancyInteger }
+ ///
+ /// fn main() {
+ /// let p = Point { x: FancyInteger(10), y: FancyInteger(20) };
+ ///
+ /// let c = || {
+ /// let x = p.x;
+ /// };
+ ///
+ /// c();
+ ///
+ /// // ... More code ...
+ /// }
+ /// ```
+ ///
+ /// {{produces}}
+ ///
+ /// ### Explanation
+ ///
+ /// In the above example `p.y` will be dropped at the end of `f` instead of with `c` if
+ /// the feature `capture_disjoint_fields` is enabled.
+ pub DISJOINT_CAPTURE_DROP_REORDER,
+ Allow,
+ "Drop reorder because of `capture_disjoint_fields`"
+
+}
+
declare_lint_pass!(UnusedDocComment => [UNUSED_DOC_COMMENTS]);
declare_lint! {