|
3 | 3 | //! These are the built-in lints that are emitted direct in the main
|
4 | 4 | //! compiler code, rather than using their own custom pass. Those
|
5 | 5 | //! lints are all available in `rustc_lint::builtin`.
|
| 6 | +//! |
| 7 | +//! When removing a lint, make sure to also add a call to `register_removed` in |
| 8 | +//! compiler/rustc_lint/src/lib.rs. |
6 | 9 |
|
7 | 10 | use crate::{declare_lint, declare_lint_pass, FutureIncompatibilityReason};
|
8 | 11 | use rustc_span::edition::Edition;
|
@@ -67,7 +70,6 @@ declare_lint_pass! {
|
67 | 70 | MUST_NOT_SUSPEND,
|
68 | 71 | NAMED_ARGUMENTS_USED_POSITIONALLY,
|
69 | 72 | NON_EXHAUSTIVE_OMITTED_PATTERNS,
|
70 |
| - NONTRIVIAL_STRUCTURAL_MATCH, |
71 | 73 | ORDER_DEPENDENT_TRAIT_OBJECTS,
|
72 | 74 | OVERLAPPING_RANGE_ENDPOINTS,
|
73 | 75 | PATTERNS_IN_FNS_WITHOUT_BODY,
|
@@ -2330,8 +2332,8 @@ declare_lint! {
|
2330 | 2332 | Warn,
|
2331 | 2333 | "constant used in pattern contains value of non-structural-match type in a field or a variant",
|
2332 | 2334 | @future_incompatible = FutureIncompatibleInfo {
|
2333 |
| - reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps, |
2334 |
| - reference: "issue #62411 <https://github.com/rust-lang/rust/issues/62411>", |
| 2335 | + reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps, |
| 2336 | + reference: "issue #120362 <https://github.com/rust-lang/rust/issues/120362>", |
2335 | 2337 | };
|
2336 | 2338 | }
|
2337 | 2339 |
|
@@ -2386,47 +2388,8 @@ declare_lint! {
|
2386 | 2388 | Warn,
|
2387 | 2389 | "pointers are not structural-match",
|
2388 | 2390 | @future_incompatible = FutureIncompatibleInfo {
|
2389 |
| - reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps, |
2390 |
| - reference: "issue #62411 <https://github.com/rust-lang/rust/issues/70861>", |
2391 |
| - }; |
2392 |
| -} |
2393 |
| - |
2394 |
| -declare_lint! { |
2395 |
| - /// The `nontrivial_structural_match` lint detects constants that are used in patterns, |
2396 |
| - /// whose type is not structural-match and whose initializer body actually uses values |
2397 |
| - /// that are not structural-match. So `Option<NotStructuralMatch>` is ok if the constant |
2398 |
| - /// is just `None`. |
2399 |
| - /// |
2400 |
| - /// ### Example |
2401 |
| - /// |
2402 |
| - /// ```rust,compile_fail |
2403 |
| - /// #![deny(nontrivial_structural_match)] |
2404 |
| - /// |
2405 |
| - /// #[derive(Copy, Clone, Debug)] |
2406 |
| - /// struct NoDerive(u32); |
2407 |
| - /// impl PartialEq for NoDerive { fn eq(&self, _: &Self) -> bool { false } } |
2408 |
| - /// impl Eq for NoDerive { } |
2409 |
| - /// fn main() { |
2410 |
| - /// const INDEX: Option<NoDerive> = [None, Some(NoDerive(10))][0]; |
2411 |
| - /// match None { Some(_) => panic!("whoops"), INDEX => dbg!(INDEX), }; |
2412 |
| - /// } |
2413 |
| - /// ``` |
2414 |
| - /// |
2415 |
| - /// {{produces}} |
2416 |
| - /// |
2417 |
| - /// ### Explanation |
2418 |
| - /// |
2419 |
| - /// Previous versions of Rust accepted constants in patterns, even if those constants' types |
2420 |
| - /// did not have `PartialEq` derived. Thus the compiler falls back to runtime execution of |
2421 |
| - /// `PartialEq`, which can report that two constants are not equal even if they are |
2422 |
| - /// bit-equivalent. |
2423 |
| - pub NONTRIVIAL_STRUCTURAL_MATCH, |
2424 |
| - Warn, |
2425 |
| - "constant used in pattern of non-structural-match type and the constant's initializer \ |
2426 |
| - expression contains values of non-structural-match types", |
2427 |
| - @future_incompatible = FutureIncompatibleInfo { |
2428 |
| - reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps, |
2429 |
| - reference: "issue #73448 <https://github.com/rust-lang/rust/issues/73448>", |
| 2391 | + reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps, |
| 2392 | + reference: "issue #120362 <https://github.com/rust-lang/rust/issues/120362>", |
2430 | 2393 | };
|
2431 | 2394 | }
|
2432 | 2395 |
|
|
0 commit comments