|
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,
|
@@ -2280,8 +2282,8 @@ declare_lint! {
|
2280 | 2282 | Warn,
|
2281 | 2283 | "constant used in pattern contains value of non-structural-match type in a field or a variant",
|
2282 | 2284 | @future_incompatible = FutureIncompatibleInfo {
|
2283 |
| - reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps, |
2284 |
| - reference: "issue #62411 <https://github.com/rust-lang/rust/issues/62411>", |
| 2285 | + reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps, |
| 2286 | + reference: "issue #120362 <https://github.com/rust-lang/rust/issues/120362>", |
2285 | 2287 | };
|
2286 | 2288 | }
|
2287 | 2289 |
|
@@ -2336,47 +2338,8 @@ declare_lint! {
|
2336 | 2338 | Warn,
|
2337 | 2339 | "pointers are not structural-match",
|
2338 | 2340 | @future_incompatible = FutureIncompatibleInfo {
|
2339 |
| - reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps, |
2340 |
| - reference: "issue #62411 <https://github.com/rust-lang/rust/issues/70861>", |
2341 |
| - }; |
2342 |
| -} |
2343 |
| - |
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>", |
| 2341 | + reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps, |
| 2342 | + reference: "issue #120362 <https://github.com/rust-lang/rust/issues/120362>", |
2380 | 2343 | };
|
2381 | 2344 | }
|
2382 | 2345 |
|
|
0 commit comments