about summary refs log tree commit diff
path: root/src/test/ui/consts/const_in_pattern
diff options
context:
space:
mode:
authorAlbert Larsan <74931857+albertlarsan68@users.noreply.github.com>2023-01-05 09:13:28 +0100
committerAlbert Larsan <74931857+albertlarsan68@users.noreply.github.com>2023-01-11 09:32:08 +0000
commitcf2dff2b1e3fa55fa5415d524200070d0d7aacfe (patch)
tree40a88d9a46aaf3e8870676eb2538378b75a263eb /src/test/ui/consts/const_in_pattern
parentca855e6e42787ecd062d81d53336fe6788ef51a9 (diff)
downloadrust-cf2dff2b1e3fa55fa5415d524200070d0d7aacfe.tar.gz
rust-cf2dff2b1e3fa55fa5415d524200070d0d7aacfe.zip
Move /src/test to /tests
Diffstat (limited to 'src/test/ui/consts/const_in_pattern')
-rw-r--r--src/test/ui/consts/const_in_pattern/accept_structural.rs66
-rw-r--r--src/test/ui/consts/const_in_pattern/auxiliary/consts.rs16
-rw-r--r--src/test/ui/consts/const_in_pattern/cross-crate-fail.rs25
-rw-r--r--src/test/ui/consts/const_in_pattern/cross-crate-fail.stderr14
-rw-r--r--src/test/ui/consts/const_in_pattern/cross-crate-pass.rs23
-rw-r--r--src/test/ui/consts/const_in_pattern/custom-eq-branch-pass.rs32
-rw-r--r--src/test/ui/consts/const_in_pattern/custom-eq-branch-warn.rs36
-rw-r--r--src/test/ui/consts/const_in_pattern/custom-eq-branch-warn.stderr12
-rw-r--r--src/test/ui/consts/const_in_pattern/incomplete-slice.rs15
-rw-r--r--src/test/ui/consts/const_in_pattern/incomplete-slice.stderr26
-rw-r--r--src/test/ui/consts/const_in_pattern/issue-44333.rs25
-rw-r--r--src/test/ui/consts/const_in_pattern/issue-44333.stderr25
-rw-r--r--src/test/ui/consts/const_in_pattern/issue-53708.rs11
-rw-r--r--src/test/ui/consts/const_in_pattern/issue-62614.rs24
-rw-r--r--src/test/ui/consts/const_in_pattern/issue-65466.rs21
-rw-r--r--src/test/ui/consts/const_in_pattern/issue-73431.rs29
-rw-r--r--src/test/ui/consts/const_in_pattern/issue-73431.stderr1
-rw-r--r--src/test/ui/consts/const_in_pattern/issue-78057.rs17
-rw-r--r--src/test/ui/consts/const_in_pattern/issue-78057.stderr23
-rw-r--r--src/test/ui/consts/const_in_pattern/no-eq-branch-fail.rs25
-rw-r--r--src/test/ui/consts/const_in_pattern/no-eq-branch-fail.stderr8
-rw-r--r--src/test/ui/consts/const_in_pattern/reject_non_partial_eq.rs32
-rw-r--r--src/test/ui/consts/const_in_pattern/reject_non_partial_eq.stderr8
-rw-r--r--src/test/ui/consts/const_in_pattern/reject_non_structural.rs83
-rw-r--r--src/test/ui/consts/const_in_pattern/reject_non_structural.stderr76
-rw-r--r--src/test/ui/consts/const_in_pattern/warn_corner_cases.rs41
-rw-r--r--src/test/ui/consts/const_in_pattern/warn_corner_cases.stderr30
27 files changed, 0 insertions, 744 deletions
diff --git a/src/test/ui/consts/const_in_pattern/accept_structural.rs b/src/test/ui/consts/const_in_pattern/accept_structural.rs
deleted file mode 100644
index 1f56f581c02..00000000000
--- a/src/test/ui/consts/const_in_pattern/accept_structural.rs
+++ /dev/null
@@ -1,66 +0,0 @@
-// run-pass
-
-#![warn(indirect_structural_match)]
-
-// This test is checking our logic for structural match checking by enumerating
-// the different kinds of const expressions. This test is collecting cases where
-// we have accepted the const expression as a pattern in the past and wish to
-// continue doing so.
-//
-// Even if a non-structural-match type is part of an expression in a const's
-// definition, that does not necessarily disqualify the const from being a match
-// pattern: in principle, we just need the types involved in the final value to
-// be structurally matchable.
-
-// See also RFC 1445
-
-#![feature(type_ascription)]
-
-#[derive(Copy, Clone, Debug)]
-struct NoPartialEq(u32);
-
-#[derive(Copy, Clone, Debug)]
-struct NoDerive(u32);
-
-// This impl makes `NoDerive` irreflexive.
-impl PartialEq for NoDerive { fn eq(&self, _: &Self) -> bool { false } }
-impl Eq for NoDerive { }
-
-type OND = Option<NoDerive>;
-
-fn main() {
-    const FIELD1: u32 = NoPartialEq(1).0;
-    match 1 { FIELD1 => dbg!(FIELD1), _ => panic!("whoops"), };
-    const FIELD2: u32 = NoDerive(1).0;
-    match 1 { FIELD2 => dbg!(FIELD2), _ => panic!("whoops"), };
-
-    enum CLike { One = 1, #[allow(dead_code)] Two = 2, }
-    const ONE_CAST: u32 = CLike::One as u32;
-    match 1 { ONE_CAST => dbg!(ONE_CAST), _ => panic!("whoops"), };
-
-    const NO_DERIVE_NONE: OND = None;
-    const INDIRECT: OND = NO_DERIVE_NONE;
-    match None { INDIRECT => dbg!(INDIRECT), _ => panic!("whoops"), };
-
-    const TUPLE: (OND, OND) = (None, None);
-    match (None, None) { TUPLE => dbg!(TUPLE), _ => panic!("whoops"), };
-
-    const TYPE_ASCRIPTION: OND = type_ascribe!(None, OND);
-    match None { TYPE_ASCRIPTION => dbg!(TYPE_ASCRIPTION), _ => panic!("whoops"), };
-
-    const ARRAY: [OND; 2] = [None, None];
-    match [None; 2] { ARRAY => dbg!(ARRAY), _ => panic!("whoops"), };
-
-    const REPEAT: [OND; 2] = [None; 2];
-    match [None, None] { REPEAT => dbg!(REPEAT), _ => panic!("whoops"), };
-
-    trait Trait: Sized { const ASSOC: Option<Self>; }
-    impl Trait for NoDerive { const ASSOC: Option<NoDerive> = None; }
-    match None { NoDerive::ASSOC => dbg!(NoDerive::ASSOC), _ => panic!("whoops"), };
-
-    const BLOCK: OND = { NoDerive(10); None };
-    match None { BLOCK => dbg!(BLOCK), _ => panic!("whoops"), };
-
-    const ADDR_OF: &OND = &None;
-    match &None { ADDR_OF => dbg!(ADDR_OF),  _ => panic!("whoops"), };
-}
diff --git a/src/test/ui/consts/const_in_pattern/auxiliary/consts.rs b/src/test/ui/consts/const_in_pattern/auxiliary/consts.rs
deleted file mode 100644
index b438bcd9fb5..00000000000
--- a/src/test/ui/consts/const_in_pattern/auxiliary/consts.rs
+++ /dev/null
@@ -1,16 +0,0 @@
-pub struct CustomEq;
-
-impl Eq for CustomEq {}
-impl PartialEq for CustomEq {
-    fn eq(&self, _: &Self) -> bool {
-        false
-    }
-}
-
-pub const NONE: Option<CustomEq> = None;
-pub const SOME: Option<CustomEq> = Some(CustomEq);
-
-pub trait AssocConst {
-    const NONE: Option<CustomEq> = None;
-    const SOME: Option<CustomEq> = Some(CustomEq);
-}
diff --git a/src/test/ui/consts/const_in_pattern/cross-crate-fail.rs b/src/test/ui/consts/const_in_pattern/cross-crate-fail.rs
deleted file mode 100644
index ab297f54dff..00000000000
--- a/src/test/ui/consts/const_in_pattern/cross-crate-fail.rs
+++ /dev/null
@@ -1,25 +0,0 @@
-// aux-build:consts.rs
-
-#![warn(indirect_structural_match)]
-
-extern crate consts;
-
-struct Defaulted;
-impl consts::AssocConst for Defaulted {}
-
-fn main() {
-    let _ = Defaulted;
-    match None {
-        consts::SOME => panic!(),
-        //~^ must be annotated with `#[derive(PartialEq, Eq)]`
-
-        _ => {}
-    }
-
-    match None {
-        <Defaulted as consts::AssocConst>::SOME  => panic!(),
-        //~^ must be annotated with `#[derive(PartialEq, Eq)]`
-
-        _ => {}
-    }
-}
diff --git a/src/test/ui/consts/const_in_pattern/cross-crate-fail.stderr b/src/test/ui/consts/const_in_pattern/cross-crate-fail.stderr
deleted file mode 100644
index a8066a88c35..00000000000
--- a/src/test/ui/consts/const_in_pattern/cross-crate-fail.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error: to use a constant of type `CustomEq` in a pattern, `CustomEq` must be annotated with `#[derive(PartialEq, Eq)]`
-  --> $DIR/cross-crate-fail.rs:13:9
-   |
-LL |         consts::SOME => panic!(),
-   |         ^^^^^^^^^^^^
-
-error: to use a constant of type `CustomEq` in a pattern, `CustomEq` must be annotated with `#[derive(PartialEq, Eq)]`
-  --> $DIR/cross-crate-fail.rs:20:9
-   |
-LL |         <Defaulted as consts::AssocConst>::SOME  => panic!(),
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to 2 previous errors
-
diff --git a/src/test/ui/consts/const_in_pattern/cross-crate-pass.rs b/src/test/ui/consts/const_in_pattern/cross-crate-pass.rs
deleted file mode 100644
index 1d8ecf8ae66..00000000000
--- a/src/test/ui/consts/const_in_pattern/cross-crate-pass.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-// run-pass
-// aux-build:consts.rs
-
-#![warn(indirect_structural_match)]
-
-extern crate consts;
-use consts::CustomEq;
-
-struct Defaulted;
-impl consts::AssocConst for Defaulted {}
-
-fn main() {
-    let _ = Defaulted;
-    match Some(CustomEq) {
-        consts::NONE => panic!(),
-        _ => {}
-    }
-
-    match Some(CustomEq) {
-        <Defaulted as consts::AssocConst>::NONE  => panic!(),
-        _ => {}
-    }
-}
diff --git a/src/test/ui/consts/const_in_pattern/custom-eq-branch-pass.rs b/src/test/ui/consts/const_in_pattern/custom-eq-branch-pass.rs
deleted file mode 100644
index a38731ceb8a..00000000000
--- a/src/test/ui/consts/const_in_pattern/custom-eq-branch-pass.rs
+++ /dev/null
@@ -1,32 +0,0 @@
-// run-pass
-
-#![warn(indirect_structural_match)]
-
-struct CustomEq;
-
-impl Eq for CustomEq {}
-impl PartialEq for CustomEq {
-    fn eq(&self, _: &Self) -> bool {
-        false
-    }
-}
-
-#[derive(PartialEq, Eq)]
-enum Foo {
-    Bar,
-    Baz,
-    Qux(CustomEq),
-}
-
-const BAR_BAZ: Foo = if 42 == 42 {
-    Foo::Bar
-} else {
-    Foo::Baz
-};
-
-fn main() {
-    match Foo::Qux(CustomEq) {
-        BAR_BAZ => panic!(),
-        _ => {}
-    }
-}
diff --git a/src/test/ui/consts/const_in_pattern/custom-eq-branch-warn.rs b/src/test/ui/consts/const_in_pattern/custom-eq-branch-warn.rs
deleted file mode 100644
index 856d204178d..00000000000
--- a/src/test/ui/consts/const_in_pattern/custom-eq-branch-warn.rs
+++ /dev/null
@@ -1,36 +0,0 @@
-// check-pass
-
-struct CustomEq;
-
-impl Eq for CustomEq {}
-impl PartialEq for CustomEq {
-    fn eq(&self, _: &Self) -> bool {
-        false
-    }
-}
-
-#[derive(PartialEq, Eq)]
-enum Foo {
-    Bar,
-    Baz,
-    Qux(CustomEq),
-}
-
-// We know that `BAR_BAZ` will always be `Foo::Bar` and thus eligible for structural matching, but
-// dataflow will be more conservative.
-const BAR_BAZ: Foo = if 42 == 42 {
-    Foo::Bar
-} else {
-    Foo::Qux(CustomEq)
-};
-
-fn main() {
-    match Foo::Qux(CustomEq) {
-        BAR_BAZ => panic!(),
-        //~^ WARN must be annotated with `#[derive(PartialEq, Eq)]`
-        //~| WARN this was previously accepted
-        //~| NOTE see issue #73448
-        //~| NOTE `#[warn(nontrivial_structural_match)]` on by default
-        _ => {}
-    }
-}
diff --git a/src/test/ui/consts/const_in_pattern/custom-eq-branch-warn.stderr b/src/test/ui/consts/const_in_pattern/custom-eq-branch-warn.stderr
deleted file mode 100644
index 22348272275..00000000000
--- a/src/test/ui/consts/const_in_pattern/custom-eq-branch-warn.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-warning: to use a constant of type `CustomEq` in a pattern, the constant's initializer must be trivial or `CustomEq` must be annotated with `#[derive(PartialEq, Eq)]`
-  --> $DIR/custom-eq-branch-warn.rs:29:9
-   |
-LL |         BAR_BAZ => panic!(),
-   |         ^^^^^^^
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #73448 <https://github.com/rust-lang/rust/issues/73448>
-   = note: `#[warn(nontrivial_structural_match)]` on by default
-
-warning: 1 warning emitted
-
diff --git a/src/test/ui/consts/const_in_pattern/incomplete-slice.rs b/src/test/ui/consts/const_in_pattern/incomplete-slice.rs
deleted file mode 100644
index e1ccda71d40..00000000000
--- a/src/test/ui/consts/const_in_pattern/incomplete-slice.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-#[derive(PartialEq)]
-enum E {
-    A,
-}
-
-const E_SL: &[E] = &[E::A];
-
-fn main() {
-    match &[][..] {
-        //~^ ERROR non-exhaustive patterns: `&_` not covered [E0004]
-        E_SL => {}
-        //~^ WARN to use a constant of type `E` in a pattern, `E` must be annotated with `#[derive(PartialEq, Eq)]`
-        //~| WARN this was previously accepted by the compiler but is being phased out
-    }
-}
diff --git a/src/test/ui/consts/const_in_pattern/incomplete-slice.stderr b/src/test/ui/consts/const_in_pattern/incomplete-slice.stderr
deleted file mode 100644
index ddc576ced8f..00000000000
--- a/src/test/ui/consts/const_in_pattern/incomplete-slice.stderr
+++ /dev/null
@@ -1,26 +0,0 @@
-warning: to use a constant of type `E` in a pattern, `E` must be annotated with `#[derive(PartialEq, Eq)]`
-  --> $DIR/incomplete-slice.rs:11:9
-   |
-LL |         E_SL => {}
-   |         ^^^^
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/62411>
-   = note: `#[warn(indirect_structural_match)]` on by default
-
-error[E0004]: non-exhaustive patterns: `&_` not covered
-  --> $DIR/incomplete-slice.rs:9:11
-   |
-LL |     match &[][..] {
-   |           ^^^^^^^ pattern `&_` not covered
-   |
-   = note: the matched value is of type `&[E]`
-help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
-   |
-LL ~         E_SL => {}
-LL +         &_ => todo!()
-   |
-
-error: aborting due to previous error; 1 warning emitted
-
-For more information about this error, try `rustc --explain E0004`.
diff --git a/src/test/ui/consts/const_in_pattern/issue-44333.rs b/src/test/ui/consts/const_in_pattern/issue-44333.rs
deleted file mode 100644
index 96e8795e52d..00000000000
--- a/src/test/ui/consts/const_in_pattern/issue-44333.rs
+++ /dev/null
@@ -1,25 +0,0 @@
-// run-pass
-
-#![warn(pointer_structural_match)]
-
-type Func = fn(usize, usize) -> usize;
-
-fn foo(a: usize, b: usize) -> usize { a + b }
-fn bar(a: usize, b: usize) -> usize { a * b }
-fn test(x: usize) -> Func {
-    if x % 2 == 0 { foo }
-    else { bar }
-}
-
-const FOO: Func = foo;
-const BAR: Func = bar;
-
-fn main() {
-    match test(std::env::consts::ARCH.len()) {
-        FOO => println!("foo"), //~ WARN pointers in patterns behave unpredictably
-        //~^ WARN will become a hard error
-        BAR => println!("bar"), //~ WARN pointers in patterns behave unpredictably
-        //~^ WARN will become a hard error
-        _ => unreachable!(),
-    }
-}
diff --git a/src/test/ui/consts/const_in_pattern/issue-44333.stderr b/src/test/ui/consts/const_in_pattern/issue-44333.stderr
deleted file mode 100644
index 731ef509cca..00000000000
--- a/src/test/ui/consts/const_in_pattern/issue-44333.stderr
+++ /dev/null
@@ -1,25 +0,0 @@
-warning: function pointers and unsized pointers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
-  --> $DIR/issue-44333.rs:19:9
-   |
-LL |         FOO => println!("foo"),
-   |         ^^^
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
-note: the lint level is defined here
-  --> $DIR/issue-44333.rs:3:9
-   |
-LL | #![warn(pointer_structural_match)]
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^
-
-warning: function pointers and unsized pointers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
-  --> $DIR/issue-44333.rs:21:9
-   |
-LL |         BAR => println!("bar"),
-   |         ^^^
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/70861>
-
-warning: 2 warnings emitted
-
diff --git a/src/test/ui/consts/const_in_pattern/issue-53708.rs b/src/test/ui/consts/const_in_pattern/issue-53708.rs
deleted file mode 100644
index 355ba63790f..00000000000
--- a/src/test/ui/consts/const_in_pattern/issue-53708.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-// check-pass
-// https://github.com/rust-lang/rust/issues/53708
-#[derive(PartialEq, Eq)]
-struct S;
-
-fn main() {
-    const C: &S = &S;
-    match C {
-        C => {}
-    }
-}
diff --git a/src/test/ui/consts/const_in_pattern/issue-62614.rs b/src/test/ui/consts/const_in_pattern/issue-62614.rs
deleted file mode 100644
index 4ea9a283618..00000000000
--- a/src/test/ui/consts/const_in_pattern/issue-62614.rs
+++ /dev/null
@@ -1,24 +0,0 @@
-// run-pass
-
-struct Sum(u32, u32);
-
-impl PartialEq for Sum {
-    fn eq(&self, other: &Self) -> bool { self.0 + self.1 == other.0 + other.1 }
-}
-
-impl Eq for Sum { }
-
-#[derive(PartialEq, Eq)]
-enum Eek {
-    TheConst,
-    UnusedByTheConst(Sum)
-}
-
-const THE_CONST: Eek = Eek::TheConst;
-
-pub fn main() {
-    match Eek::UnusedByTheConst(Sum(1,2)) {
-        THE_CONST => { panic!(); }
-        _ => {}
-    }
-}
diff --git a/src/test/ui/consts/const_in_pattern/issue-65466.rs b/src/test/ui/consts/const_in_pattern/issue-65466.rs
deleted file mode 100644
index 2b421f4c705..00000000000
--- a/src/test/ui/consts/const_in_pattern/issue-65466.rs
+++ /dev/null
@@ -1,21 +0,0 @@
-#![deny(indirect_structural_match)]
-
-// check-pass
-
-#[derive(PartialEq, Eq)]
-enum O<T> {
-    Some(*const T), // Can also use PhantomData<T>
-    None,
-}
-
-struct B;
-
-const C: &[O<B>] = &[O::None];
-
-fn main() {
-    let x = O::None;
-    match &[x][..] {
-        C => (),
-        _ => (),
-    }
-}
diff --git a/src/test/ui/consts/const_in_pattern/issue-73431.rs b/src/test/ui/consts/const_in_pattern/issue-73431.rs
deleted file mode 100644
index fa18a3af1b0..00000000000
--- a/src/test/ui/consts/const_in_pattern/issue-73431.rs
+++ /dev/null
@@ -1,29 +0,0 @@
-// run-pass
-
-// Regression test for https://github.com/rust-lang/rust/issues/73431.
-
-pub trait Zero {
-    const ZERO: Self;
-}
-
-impl Zero for usize {
-    const ZERO: Self = 0;
-}
-
-impl<T: Zero> Zero for Wrapper<T> {
-    const ZERO: Self = Wrapper(T::ZERO);
-}
-
-#[derive(Debug, PartialEq, Eq)]
-pub struct Wrapper<T>(T);
-
-fn is_zero(x: Wrapper<usize>) -> bool {
-    match x {
-        Zero::ZERO => true,
-        _ => false,
-    }
-}
-
-fn main() {
-    let _ = is_zero(Wrapper(42));
-}
diff --git a/src/test/ui/consts/const_in_pattern/issue-73431.stderr b/src/test/ui/consts/const_in_pattern/issue-73431.stderr
deleted file mode 100644
index c82dea4aa50..00000000000
--- a/src/test/ui/consts/const_in_pattern/issue-73431.stderr
+++ /dev/null
@@ -1 +0,0 @@
-WARN rustc_mir_build::thir::pattern::const_to_pat MIR const-checker found novel structural match violation. See #73448.
diff --git a/src/test/ui/consts/const_in_pattern/issue-78057.rs b/src/test/ui/consts/const_in_pattern/issue-78057.rs
deleted file mode 100644
index 69cf8404da1..00000000000
--- a/src/test/ui/consts/const_in_pattern/issue-78057.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-#![deny(unreachable_patterns)]
-
-#[derive(PartialEq)]
-struct Opaque(i32);
-
-impl Eq for Opaque {}
-
-const FOO: Opaque = Opaque(42);
-
-fn main() {
-    match FOO {
-        FOO => {},
-        //~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
-        _ => {}
-        //~^ ERROR unreachable pattern
-    }
-}
diff --git a/src/test/ui/consts/const_in_pattern/issue-78057.stderr b/src/test/ui/consts/const_in_pattern/issue-78057.stderr
deleted file mode 100644
index 35619594f75..00000000000
--- a/src/test/ui/consts/const_in_pattern/issue-78057.stderr
+++ /dev/null
@@ -1,23 +0,0 @@
-error: to use a constant of type `Opaque` in a pattern, `Opaque` must be annotated with `#[derive(PartialEq, Eq)]`
-  --> $DIR/issue-78057.rs:12:9
-   |
-LL |         FOO => {},
-   |         ^^^
-
-error: unreachable pattern
-  --> $DIR/issue-78057.rs:14:9
-   |
-LL |         FOO => {},
-   |         --- matches any value
-LL |
-LL |         _ => {}
-   |         ^ unreachable pattern
-   |
-note: the lint level is defined here
-  --> $DIR/issue-78057.rs:1:9
-   |
-LL | #![deny(unreachable_patterns)]
-   |         ^^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to 2 previous errors
-
diff --git a/src/test/ui/consts/const_in_pattern/no-eq-branch-fail.rs b/src/test/ui/consts/const_in_pattern/no-eq-branch-fail.rs
deleted file mode 100644
index fc80d51c72d..00000000000
--- a/src/test/ui/consts/const_in_pattern/no-eq-branch-fail.rs
+++ /dev/null
@@ -1,25 +0,0 @@
-#![warn(indirect_structural_match)]
-
-struct NoEq;
-
-enum Foo {
-    Bar,
-    Baz,
-    Qux(NoEq),
-}
-
-// Even though any of these values can be compared structurally, we still disallow it in a pattern
-// because `Foo` does not impl `PartialEq`.
-const BAR_BAZ: Foo = if 42 == 42 {
-    Foo::Baz
-} else {
-    Foo::Bar
-};
-
-fn main() {
-    match Foo::Qux(NoEq) {
-        BAR_BAZ => panic!(),
-        //~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
-        _ => {}
-    }
-}
diff --git a/src/test/ui/consts/const_in_pattern/no-eq-branch-fail.stderr b/src/test/ui/consts/const_in_pattern/no-eq-branch-fail.stderr
deleted file mode 100644
index e505dad69be..00000000000
--- a/src/test/ui/consts/const_in_pattern/no-eq-branch-fail.stderr
+++ /dev/null
@@ -1,8 +0,0 @@
-error: to use a constant of type `Foo` in a pattern, `Foo` must be annotated with `#[derive(PartialEq, Eq)]`
-  --> $DIR/no-eq-branch-fail.rs:21:9
-   |
-LL |         BAR_BAZ => panic!(),
-   |         ^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/consts/const_in_pattern/reject_non_partial_eq.rs b/src/test/ui/consts/const_in_pattern/reject_non_partial_eq.rs
deleted file mode 100644
index a8216901c02..00000000000
--- a/src/test/ui/consts/const_in_pattern/reject_non_partial_eq.rs
+++ /dev/null
@@ -1,32 +0,0 @@
-// This test is illustrating the difference between how failing to derive
-// `PartialEq` is handled compared to failing to implement it at all.
-
-// See also RFC 1445
-
-#[derive(PartialEq, Eq)]
-struct Structural(u32);
-
-struct NoPartialEq(u32);
-
-struct NoDerive(u32);
-
-// This impl makes NoDerive irreflexive.
-impl PartialEq for NoDerive { fn eq(&self, _: &Self) -> bool { false } }
-
-impl Eq for NoDerive { }
-
-const NO_DERIVE_NONE: Option<NoDerive> = None;
-const NO_PARTIAL_EQ_NONE: Option<NoPartialEq> = None;
-
-fn main() {
-    match None {
-        NO_DERIVE_NONE => println!("NO_DERIVE_NONE"),
-        _ => panic!("whoops"),
-    }
-
-    match None {
-        NO_PARTIAL_EQ_NONE => println!("NO_PARTIAL_EQ_NONE"),
-        //~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
-        _ => panic!("whoops"),
-    }
-}
diff --git a/src/test/ui/consts/const_in_pattern/reject_non_partial_eq.stderr b/src/test/ui/consts/const_in_pattern/reject_non_partial_eq.stderr
deleted file mode 100644
index 95cfa4a9ebe..00000000000
--- a/src/test/ui/consts/const_in_pattern/reject_non_partial_eq.stderr
+++ /dev/null
@@ -1,8 +0,0 @@
-error: to use a constant of type `NoPartialEq` in a pattern, `NoPartialEq` must be annotated with `#[derive(PartialEq, Eq)]`
-  --> $DIR/reject_non_partial_eq.rs:28:9
-   |
-LL |         NO_PARTIAL_EQ_NONE => println!("NO_PARTIAL_EQ_NONE"),
-   |         ^^^^^^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/consts/const_in_pattern/reject_non_structural.rs b/src/test/ui/consts/const_in_pattern/reject_non_structural.rs
deleted file mode 100644
index 75fde0d92de..00000000000
--- a/src/test/ui/consts/const_in_pattern/reject_non_structural.rs
+++ /dev/null
@@ -1,83 +0,0 @@
-// This test of structural match checking enumerates the different kinds of
-// const definitions, collecting cases where the const pattern is rejected.
-//
-// Note: Even if a non-structural-match type is part of an expression in a
-// const's definition, that does not necessarily disqualify the const from being
-// a match pattern: in principle, we just need the types involved in the final
-// value to be structurally matchable.
-
-// See also RFC 1445
-
-#![feature(type_ascription)]
-#![warn(indirect_structural_match)]
-//~^ NOTE lint level is defined here
-
-#[derive(Copy, Clone, Debug)]
-struct NoPartialEq;
-
-#[derive(Copy, Clone, Debug)]
-struct NoDerive;
-
-// This impl makes `NoDerive` irreflexive.
-impl PartialEq for NoDerive { fn eq(&self, _: &Self) -> bool { false } }
-
-impl Eq for NoDerive { }
-
-type OND = Option<NoDerive>;
-
-struct TrivialEq(OND);
-
-// This impl makes `TrivialEq` trivial.
-impl PartialEq for TrivialEq { fn eq(&self, _: &Self) -> bool { true } }
-
-impl Eq for TrivialEq { }
-
-fn main() {
-    #[derive(PartialEq, Eq, Debug)]
-    enum Derive<X> { Some(X), None, }
-
-    const ENUM: Derive<NoDerive> = Derive::Some(NoDerive);
-    match Derive::Some(NoDerive) { ENUM => dbg!(ENUM), _ => panic!("whoops"), };
-    //~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
-
-    const FIELD: OND = TrivialEq(Some(NoDerive)).0;
-    match Some(NoDerive) { FIELD => dbg!(FIELD), _ => panic!("whoops"), };
-    //~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
-
-    const NO_DERIVE_SOME: OND = Some(NoDerive);
-    const INDIRECT: OND = NO_DERIVE_SOME;
-    match Some(NoDerive) {INDIRECT => dbg!(INDIRECT), _ => panic!("whoops"), };
-    //~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
-
-    const TUPLE: (OND, OND) = (None, Some(NoDerive));
-    match (None, Some(NoDerive)) { TUPLE => dbg!(TUPLE), _ => panic!("whoops"), };
-    //~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
-
-    const TYPE_ASCRIPTION: OND = type_ascribe!(Some(NoDerive), OND);
-    match Some(NoDerive) { TYPE_ASCRIPTION => dbg!(TYPE_ASCRIPTION), _ => panic!("whoops"), };
-    //~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
-
-    const ARRAY: [OND; 2] = [None, Some(NoDerive)];
-    match [None, Some(NoDerive)] { ARRAY => dbg!(ARRAY), _ => panic!("whoops"), };
-    //~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
-
-    const REPEAT: [OND; 2] = [Some(NoDerive); 2];
-    match [Some(NoDerive); 2] { REPEAT => dbg!(REPEAT), _ => panic!("whoops"), };
-    //~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
-    //~| ERROR must be annotated with `#[derive(PartialEq, Eq)]`
-
-    trait Trait: Sized { const ASSOC: Option<Self>; }
-    impl Trait for NoDerive { const ASSOC: Option<NoDerive> = Some(NoDerive); }
-    match Some(NoDerive) { NoDerive::ASSOC => dbg!(NoDerive::ASSOC), _ => panic!("whoops"), };
-    //~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
-
-    const BLOCK: OND = { NoDerive; Some(NoDerive) };
-    match Some(NoDerive) { BLOCK => dbg!(BLOCK), _ => panic!("whoops"), };
-    //~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
-
-    const ADDR_OF: &OND = &Some(NoDerive);
-    match &Some(NoDerive) { ADDR_OF => dbg!(ADDR_OF), _ => panic!("whoops"), };
-    //~^ WARN must be annotated with `#[derive(PartialEq, Eq)]`
-    //~| WARN previously accepted by the compiler but is being phased out
-    //~| NOTE for more information, see issue #62411
-}
diff --git a/src/test/ui/consts/const_in_pattern/reject_non_structural.stderr b/src/test/ui/consts/const_in_pattern/reject_non_structural.stderr
deleted file mode 100644
index 66019834997..00000000000
--- a/src/test/ui/consts/const_in_pattern/reject_non_structural.stderr
+++ /dev/null
@@ -1,76 +0,0 @@
-error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
-  --> $DIR/reject_non_structural.rs:40:36
-   |
-LL |     match Derive::Some(NoDerive) { ENUM => dbg!(ENUM), _ => panic!("whoops"), };
-   |                                    ^^^^
-
-error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
-  --> $DIR/reject_non_structural.rs:44:28
-   |
-LL |     match Some(NoDerive) { FIELD => dbg!(FIELD), _ => panic!("whoops"), };
-   |                            ^^^^^
-
-error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
-  --> $DIR/reject_non_structural.rs:49:27
-   |
-LL |     match Some(NoDerive) {INDIRECT => dbg!(INDIRECT), _ => panic!("whoops"), };
-   |                           ^^^^^^^^
-
-error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
-  --> $DIR/reject_non_structural.rs:53:36
-   |
-LL |     match (None, Some(NoDerive)) { TUPLE => dbg!(TUPLE), _ => panic!("whoops"), };
-   |                                    ^^^^^
-
-error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
-  --> $DIR/reject_non_structural.rs:57:28
-   |
-LL |     match Some(NoDerive) { TYPE_ASCRIPTION => dbg!(TYPE_ASCRIPTION), _ => panic!("whoops"), };
-   |                            ^^^^^^^^^^^^^^^
-
-error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
-  --> $DIR/reject_non_structural.rs:61:36
-   |
-LL |     match [None, Some(NoDerive)] { ARRAY => dbg!(ARRAY), _ => panic!("whoops"), };
-   |                                    ^^^^^
-
-error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
-  --> $DIR/reject_non_structural.rs:65:33
-   |
-LL |     match [Some(NoDerive); 2] { REPEAT => dbg!(REPEAT), _ => panic!("whoops"), };
-   |                                 ^^^^^^
-
-error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
-  --> $DIR/reject_non_structural.rs:65:33
-   |
-LL |     match [Some(NoDerive); 2] { REPEAT => dbg!(REPEAT), _ => panic!("whoops"), };
-   |                                 ^^^^^^
-
-error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
-  --> $DIR/reject_non_structural.rs:71:28
-   |
-LL |     match Some(NoDerive) { NoDerive::ASSOC => dbg!(NoDerive::ASSOC), _ => panic!("whoops"), };
-   |                            ^^^^^^^^^^^^^^^
-
-error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
-  --> $DIR/reject_non_structural.rs:75:28
-   |
-LL |     match Some(NoDerive) { BLOCK => dbg!(BLOCK), _ => panic!("whoops"), };
-   |                            ^^^^^
-
-warning: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
-  --> $DIR/reject_non_structural.rs:79:29
-   |
-LL |     match &Some(NoDerive) { ADDR_OF => dbg!(ADDR_OF), _ => panic!("whoops"), };
-   |                             ^^^^^^^
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/62411>
-note: the lint level is defined here
-  --> $DIR/reject_non_structural.rs:12:9
-   |
-LL | #![warn(indirect_structural_match)]
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to 10 previous errors; 1 warning emitted
-
diff --git a/src/test/ui/consts/const_in_pattern/warn_corner_cases.rs b/src/test/ui/consts/const_in_pattern/warn_corner_cases.rs
deleted file mode 100644
index 15cf3c84d85..00000000000
--- a/src/test/ui/consts/const_in_pattern/warn_corner_cases.rs
+++ /dev/null
@@ -1,41 +0,0 @@
-// run-pass
-
-// This test is checking our logic for structural match checking by enumerating
-// the different kinds of const expressions. This test is collecting cases where
-// we have accepted the const expression as a pattern in the past but we want
-// to begin warning the user that a future version of Rust may start rejecting
-// such const expressions.
-
-// The specific corner cases we are exploring here are instances where the
-// const-evaluator computes a value that *does* meet the conditions for
-// structural-match, but the const expression itself has abstractions (like
-// calls to const functions) that may fit better with a type-based analysis
-// rather than a commitment to a specific value.
-
-#![warn(indirect_structural_match)]
-
-#[derive(Copy, Clone, Debug)]
-struct NoDerive(#[allow(unused_tuple_struct_fields)] u32);
-
-// This impl makes `NoDerive` irreflexive.
-impl PartialEq for NoDerive { fn eq(&self, _: &Self) -> bool { false } }
-impl Eq for NoDerive { }
-
-fn main() {
-    const INDEX: Option<NoDerive> = [None, Some(NoDerive(10))][0];
-    match None { Some(_) => panic!("whoops"), INDEX => dbg!(INDEX), };
-    //~^ WARN must be annotated with `#[derive(PartialEq, Eq)]`
-    //~| WARN this was previously accepted
-
-    const fn build() -> Option<NoDerive> { None }
-    const CALL: Option<NoDerive> = build();
-    match None { Some(_) => panic!("whoops"), CALL => dbg!(CALL), };
-    //~^ WARN must be annotated with `#[derive(PartialEq, Eq)]`
-    //~| WARN this was previously accepted
-
-    impl NoDerive { const fn none() -> Option<NoDerive> { None } }
-    const METHOD_CALL: Option<NoDerive> = NoDerive::none();
-    match None { Some(_) => panic!("whoops"), METHOD_CALL => dbg!(METHOD_CALL), };
-    //~^ WARN must be annotated with `#[derive(PartialEq, Eq)]`
-    //~| WARN this was previously accepted
-}
diff --git a/src/test/ui/consts/const_in_pattern/warn_corner_cases.stderr b/src/test/ui/consts/const_in_pattern/warn_corner_cases.stderr
deleted file mode 100644
index e957a43a13d..00000000000
--- a/src/test/ui/consts/const_in_pattern/warn_corner_cases.stderr
+++ /dev/null
@@ -1,30 +0,0 @@
-warning: to use a constant of type `NoDerive` in a pattern, the constant's initializer must be trivial or `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
-  --> $DIR/warn_corner_cases.rs:26:47
-   |
-LL |     match None { Some(_) => panic!("whoops"), INDEX => dbg!(INDEX), };
-   |                                               ^^^^^
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #73448 <https://github.com/rust-lang/rust/issues/73448>
-   = note: `#[warn(nontrivial_structural_match)]` on by default
-
-warning: to use a constant of type `NoDerive` in a pattern, the constant's initializer must be trivial or `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
-  --> $DIR/warn_corner_cases.rs:32:47
-   |
-LL |     match None { Some(_) => panic!("whoops"), CALL => dbg!(CALL), };
-   |                                               ^^^^
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #73448 <https://github.com/rust-lang/rust/issues/73448>
-
-warning: to use a constant of type `NoDerive` in a pattern, the constant's initializer must be trivial or `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
-  --> $DIR/warn_corner_cases.rs:38:47
-   |
-LL |     match None { Some(_) => panic!("whoops"), METHOD_CALL => dbg!(METHOD_CALL), };
-   |                                               ^^^^^^^^^^^
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #73448 <https://github.com/rust-lang/rust/issues/73448>
-
-warning: 3 warnings emitted
-