|
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;
|
@@ -66,7 +69,6 @@ declare_lint_pass! {
|
66 | 69 | MUST_NOT_SUSPEND,
|
67 | 70 | NAMED_ARGUMENTS_USED_POSITIONALLY,
|
68 | 71 | NON_EXHAUSTIVE_OMITTED_PATTERNS,
|
69 |
| - NONTRIVIAL_STRUCTURAL_MATCH, |
70 | 72 | ORDER_DEPENDENT_TRAIT_OBJECTS,
|
71 | 73 | OVERLAPPING_RANGE_ENDPOINTS,
|
72 | 74 | PATTERNS_IN_FNS_WITHOUT_BODY,
|
@@ -2341,45 +2343,6 @@ declare_lint! {
|
2341 | 2343 | };
|
2342 | 2344 | }
|
2343 | 2345 |
|
2344 |
| -declare_lint! { |
2345 |
| - /// The `nontrivial_structural_match` lint detects constants that are used in patterns, |
2346 |
| - /// whose type is not structural-match and whose initializer body actually uses values |
2347 |
| - /// that are not structural-match. So `Option<NotStructuralMatch>` is ok if the constant |
2348 |
| - /// is just `None`. |
2349 |
| - /// |
2350 |
| - /// ### Example |
2351 |
| - /// |
2352 |
| - /// ```rust,compile_fail |
2353 |
| - /// #![deny(nontrivial_structural_match)] |
2354 |
| - /// |
2355 |
| - /// #[derive(Copy, Clone, Debug)] |
2356 |
| - /// struct NoDerive(u32); |
2357 |
| - /// impl PartialEq for NoDerive { fn eq(&self, _: &Self) -> bool { false } } |
2358 |
| - /// impl Eq for NoDerive { } |
2359 |
| - /// fn main() { |
2360 |
| - /// const INDEX: Option<NoDerive> = [None, Some(NoDerive(10))][0]; |
2361 |
| - /// match None { Some(_) => panic!("whoops"), INDEX => dbg!(INDEX), }; |
2362 |
| - /// } |
2363 |
| - /// ``` |
2364 |
| - /// |
2365 |
| - /// {{produces}} |
2366 |
| - /// |
2367 |
| - /// ### Explanation |
2368 |
| - /// |
2369 |
| - /// Previous versions of Rust accepted constants in patterns, even if those constants' types |
2370 |
| - /// did not have `PartialEq` derived. Thus the compiler falls back to runtime execution of |
2371 |
| - /// `PartialEq`, which can report that two constants are not equal even if they are |
2372 |
| - /// bit-equivalent. |
2373 |
| - pub NONTRIVIAL_STRUCTURAL_MATCH, |
2374 |
| - Warn, |
2375 |
| - "constant used in pattern of non-structural-match type and the constant's initializer \ |
2376 |
| - expression contains values of non-structural-match types", |
2377 |
| - @future_incompatible = FutureIncompatibleInfo { |
2378 |
| - reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps, |
2379 |
| - reference: "issue #73448 <https://github.com/rust-lang/rust/issues/73448>", |
2380 |
| - }; |
2381 |
| -} |
2382 |
| - |
2383 | 2346 | declare_lint! {
|
2384 | 2347 | /// The `const_patterns_without_partial_eq` lint detects constants that are used in patterns,
|
2385 | 2348 | /// whose type does not implement `PartialEq`.
|
|
0 commit comments