]> git.lizzy.rs Git - rust.git/commitdiff
Deduplicate errors in const to pat conversion
authorOliver Scherer <github35764891676564198441@oli-obk.de>
Wed, 23 Sep 2020 15:03:31 +0000 (17:03 +0200)
committerOliver Scherer <github35764891676564198441@oli-obk.de>
Wed, 23 Sep 2020 15:03:31 +0000 (17:03 +0200)
29 files changed:
compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs
src/test/ui/consts/const_in_pattern/cross-crate-fail.rs
src/test/ui/consts/const_in_pattern/cross-crate-fail.stderr
src/test/ui/consts/const_in_pattern/no-eq-branch-fail.rs
src/test/ui/consts/const_in_pattern/no-eq-branch-fail.stderr
src/test/ui/consts/const_in_pattern/reject_non_partial_eq.rs
src/test/ui/consts/const_in_pattern/reject_non_partial_eq.stderr
src/test/ui/consts/const_in_pattern/reject_non_structural.rs
src/test/ui/consts/const_in_pattern/reject_non_structural.stderr
src/test/ui/match/issue-70972-dyn-trait.rs
src/test/ui/match/issue-70972-dyn-trait.stderr
src/test/ui/pattern/issue-71042-opaquely-typed-constant-used-in-pattern.rs
src/test/ui/pattern/issue-71042-opaquely-typed-constant-used-in-pattern.stderr
src/test/ui/rfc1445/cant-hide-behind-direct-struct-embedded.rs
src/test/ui/rfc1445/cant-hide-behind-direct-struct-embedded.stderr
src/test/ui/rfc1445/cant-hide-behind-direct-struct-param.rs
src/test/ui/rfc1445/cant-hide-behind-direct-struct-param.stderr
src/test/ui/rfc1445/match-forbidden-without-eq.rs
src/test/ui/rfc1445/match-forbidden-without-eq.stderr
src/test/ui/rfc1445/match-nonempty-array-forbidden-without-eq.rs
src/test/ui/rfc1445/match-nonempty-array-forbidden-without-eq.stderr
src/test/ui/rfc1445/match-requires-both-partialeq-and-eq.rs
src/test/ui/rfc1445/match-requires-both-partialeq-and-eq.stderr
src/test/ui/type-alias-impl-trait/structural-match-no-leak.rs
src/test/ui/type-alias-impl-trait/structural-match-no-leak.stderr
src/test/ui/type-alias-impl-trait/structural-match.rs
src/test/ui/type-alias-impl-trait/structural-match.stderr
src/test/ui/union/union-const-pat.rs
src/test/ui/union/union-const-pat.stderr

index 3c0dec64693fe5a79a1d19357293e6afa36274e6..9af40acc6d6168ef2b6a41b14fd9b3456352c4d7 100644 (file)
@@ -252,7 +252,12 @@ fn recur(
             ty::Adt(adt_def, _) if adt_def.is_union() => {
                 // Matching on union fields is unsafe, we can't hide it in constants
                 self.saw_const_match_error.set(true);
-                tcx.sess.span_err(span, "cannot use unions in constant patterns");
+                let msg = "cannot use unions in constant patterns";
+                if self.include_lint_checks {
+                    tcx.sess.span_err(span, msg);
+                } else {
+                    tcx.sess.delay_span_bug(span, msg)
+                }
                 PatKind::Wild
             }
             ty::Adt(..)
@@ -267,7 +272,11 @@ fn recur(
                     cv.ty, cv.ty,
                 );
                 self.saw_const_match_error.set(true);
-                self.tcx().sess.span_err(self.span, &msg);
+                if self.include_lint_checks {
+                    tcx.sess.span_err(self.span, &msg);
+                } else {
+                    tcx.sess.delay_span_bug(self.span, &msg)
+                }
                 PatKind::Wild
             }
             // If the type is not structurally comparable, just emit the constant directly,
@@ -308,7 +317,11 @@ fn recur(
                     path, path,
                 );
                 self.saw_const_match_error.set(true);
-                tcx.sess.span_err(span, &msg);
+                if self.include_lint_checks {
+                    tcx.sess.span_err(span, &msg);
+                } else {
+                    tcx.sess.delay_span_bug(span, &msg)
+                }
                 PatKind::Wild
             }
             ty::Adt(adt_def, substs) if adt_def.is_enum() => {
@@ -340,7 +353,12 @@ fn recur(
                 // These are not allowed and will error elsewhere anyway.
                 ty::Dynamic(..) => {
                     self.saw_const_match_error.set(true);
-                    tcx.sess.span_err(span, &format!("`{}` cannot be used in patterns", cv.ty));
+                    let msg = format!("`{}` cannot be used in patterns", cv.ty);
+                    if self.include_lint_checks {
+                        tcx.sess.span_err(span, &msg);
+                    } else {
+                        tcx.sess.delay_span_bug(span, &msg)
+                    }
                     PatKind::Wild
                 }
                 // `&str` and `&[u8]` are represented as `ConstValue::Slice`, let's keep using this
@@ -427,7 +445,12 @@ fn recur(
             }
             _ => {
                 self.saw_const_match_error.set(true);
-                tcx.sess.span_err(span, &format!("`{}` cannot be used in patterns", cv.ty));
+                let msg = format!("`{}` cannot be used in patterns", cv.ty);
+                if self.include_lint_checks {
+                    tcx.sess.span_err(span, &msg);
+                } else {
+                    tcx.sess.delay_span_bug(span, &msg)
+                }
                 PatKind::Wild
             }
         };
index 05c53e5edccc596fbed49c82bb624c7f761df84b..ab297f54dff3ea243372e3be3e7f4beb8dbc7d98 100644 (file)
@@ -12,7 +12,6 @@ fn main() {
     match None {
         consts::SOME => panic!(),
         //~^ must be annotated with `#[derive(PartialEq, Eq)]`
-        //~| must be annotated with `#[derive(PartialEq, Eq)]`
 
         _ => {}
     }
@@ -20,7 +19,6 @@ fn main() {
     match None {
         <Defaulted as consts::AssocConst>::SOME  => panic!(),
         //~^ must be annotated with `#[derive(PartialEq, Eq)]`
-        //~| must be annotated with `#[derive(PartialEq, Eq)]`
 
         _ => {}
     }
index 95db19e342a9592f3dac19e19f61ab47940f1e64..a8066a88c35a6675d706ce29a9edfe7a7a8b0a29 100644 (file)
@@ -5,22 +5,10 @@ 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:21:9
+  --> $DIR/cross-crate-fail.rs:20:9
    |
 LL |         <Defaulted as consts::AssocConst>::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: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:21:9
-   |
-LL |         <Defaulted as consts::AssocConst>::SOME  => panic!(),
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to 4 previous errors
+error: aborting due to 2 previous errors
 
index c7f02c615a02a75bff67836a40bed0a5e0309fff..fc80d51c72daa80c48f5c4c7fbdc7bcc30883f70 100644 (file)
@@ -20,7 +20,6 @@ fn main() {
     match Foo::Qux(NoEq) {
         BAR_BAZ => panic!(),
         //~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
-        //~| ERROR must be annotated with `#[derive(PartialEq, Eq)]`
         _ => {}
     }
 }
index ee78c6f5c3e9f9206b603857e0372ed5d104027d..e505dad69be072f8b014abd77f21173dc8a54f45 100644 (file)
@@ -4,11 +4,5 @@ error: to use a constant of type `Foo` in a pattern, `Foo` must be annotated wit
 LL |         BAR_BAZ => panic!(),
    |         ^^^^^^^
 
-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 2 previous errors
+error: aborting due to previous error
 
index b2b2daa830f8990cdc0727eca254494f96969667..a8216901c027f2f057dd416da6961430727c9aae 100644 (file)
@@ -27,7 +27,6 @@ fn main() {
     match None {
         NO_PARTIAL_EQ_NONE => println!("NO_PARTIAL_EQ_NONE"),
         //~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
-        //~| ERROR must be annotated with `#[derive(PartialEq, Eq)]`
         _ => panic!("whoops"),
     }
 }
index dc830d360031ac387610852dcc4243449a5716d8..8462c32ea809b401eb3056eb62ca27b45faefec5 100644 (file)
@@ -4,11 +4,5 @@ error: to use a constant of type `Option<NoPartialEq>` in a pattern, `Option<NoP
 LL |         NO_PARTIAL_EQ_NONE => println!("NO_PARTIAL_EQ_NONE"),
    |         ^^^^^^^^^^^^^^^^^^
 
-error: to use a constant of type `Option<NoPartialEq>` in a pattern, `Option<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 2 previous errors
+error: aborting due to previous error
 
index bbeaeea1f87d8da3a036ee6050fb0aa3bd08d009..7a8169bec45beadbcd6d6ed6ab72b61f87055ceb 100644 (file)
@@ -39,51 +39,41 @@ 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)]`
-    //~| 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)]`
-    //~| 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)]`
-    //~| 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)]`
-    //~| ERROR must be annotated with `#[derive(PartialEq, Eq)]`
 
     const TYPE_ASCRIPTION: OND = Some(NoDerive): OND;
     match Some(NoDerive) { TYPE_ASCRIPTION => dbg!(TYPE_ASCRIPTION), _ => panic!("whoops"), };
     //~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
-    //~| 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)]`
-    //~| 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)]`
-    //~| 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)]`
-    //~| 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)]`
-    //~| ERROR must be annotated with `#[derive(PartialEq, Eq)]`
 
     const ADDR_OF: &OND = &Some(NoDerive);
     match &Some(NoDerive) { ADDR_OF => dbg!(ADDR_OF), _ => panic!("whoops"), };
index b1310cf101eaa31d54b9f95fa191140038bbfefe..56405a55d699d83770ec8af3293b47199052c724 100644 (file)
@@ -5,61 +5,61 @@ 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:45:28
+  --> $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:51:27
+  --> $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:56:36
+  --> $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:61:28
+  --> $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:66:36
+  --> $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:71:33
+  --> $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:33
+  --> $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:79:28
+  --> $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:84:28
+  --> $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:89:29
+  --> $DIR/reject_non_structural.rs:79:29
    |
 LL |     match &Some(NoDerive) { ADDR_OF => dbg!(ADDR_OF), _ => panic!("whoops"), };
    |                             ^^^^^^^
@@ -72,65 +72,5 @@ LL | #![warn(indirect_structural_match)]
    = 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>
 
-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:45: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:51: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:56: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:61: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:66: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:71: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: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:79: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:84:28
-   |
-LL |     match Some(NoDerive) { BLOCK => dbg!(BLOCK), _ => panic!("whoops"), };
-   |                            ^^^^^
-
-error: aborting due to 20 previous errors; 1 warning emitted
+error: aborting due to 10 previous errors; 1 warning emitted
 
index b69e2dab2650bc7d5c05a1ab313f94e9b7cfe795..97d161c59ec2a8fd8e7308d20111dad6a2b8f3e2 100644 (file)
@@ -5,7 +5,6 @@ fn main() {
     match a {
         F => panic!(),
         //~^ ERROR `&dyn Send` cannot be used in patterns
-        //~| ERROR `&dyn Send` cannot be used in patterns
         _ => {}
     }
 }
index 985799b3c8357973cfab8a8ffb1695125031ef15..7581070ebc1726b64189ae39b522703c0492448e 100644 (file)
@@ -4,11 +4,5 @@ error: `&dyn Send` cannot be used in patterns
 LL |         F => panic!(),
    |         ^
 
-error: `&dyn Send` cannot be used in patterns
-  --> $DIR/issue-70972-dyn-trait.rs:6:9
-   |
-LL |         F => panic!(),
-   |         ^
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
index 0c38b533a16e6fd0365840bdeb149dc93f2a4ca5..427f4cd8c780cf91067b4383443d8ee4e4367289 100644 (file)
@@ -5,7 +5,6 @@ fn main() {
     const C: impl Copy = 0;
     match C {
         C => {} //~ ERROR: `impl Copy` cannot be used in patterns
-        //~^ ERROR: `impl Copy` cannot be used in patterns
         _ => {}
     }
 }
index ad6cc0aa3e3e9ed9c8829b635271169b6c42f0c1..c22e6eb944394ae149813be24bf76adccdf637ef 100644 (file)
@@ -4,11 +4,5 @@ error: `impl Copy` cannot be used in patterns
 LL |         C => {}
    |         ^
 
-error: `impl Copy` cannot be used in patterns
-  --> $DIR/issue-71042-opaquely-typed-constant-used-in-pattern.rs:7:9
-   |
-LL |         C => {}
-   |         ^
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
index c663535e533bd162e13f788767676b628eb4db86..4a8a09493798eb33ae463005dfef96d95b74ecbe 100644 (file)
@@ -21,7 +21,6 @@ fn main() {
     match WRAP_DIRECT_INLINE {
         WRAP_DIRECT_INLINE => { panic!("WRAP_DIRECT_INLINE matched itself"); }
         //~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
-        //~| ERROR must be annotated with `#[derive(PartialEq, Eq)]`
         _ => { println!("WRAP_DIRECT_INLINE did not match itself"); }
     }
 }
index 9c7d1f3a18fecdd5b7f10747c0993cd91d0d5b91..c73a6cf1326b3e3a7401deec42407cebeeb144f8 100644 (file)
@@ -4,11 +4,5 @@ error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be ann
 LL |         WRAP_DIRECT_INLINE => { panic!("WRAP_DIRECT_INLINE matched itself"); }
    |         ^^^^^^^^^^^^^^^^^^
 
-error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
-  --> $DIR/cant-hide-behind-direct-struct-embedded.rs:22:9
-   |
-LL |         WRAP_DIRECT_INLINE => { panic!("WRAP_DIRECT_INLINE matched itself"); }
-   |         ^^^^^^^^^^^^^^^^^^
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
index 872bf5a63fffd957a9c2b142d4203cded5e1ede4..93022a23dbfb8d5b74868f529e320e5eb9c5ad99 100644 (file)
@@ -21,7 +21,6 @@ fn main() {
     match WRAP_DIRECT_PARAM {
         WRAP_DIRECT_PARAM => { panic!("WRAP_DIRECT_PARAM matched itself"); }
         //~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
-        //~| ERROR must be annotated with `#[derive(PartialEq, Eq)]`
         _ => { println!("WRAP_DIRECT_PARAM did not match itself"); }
     }
 }
index 6f49a8a0c9d212b036e7dbaa3eaefd657e8d6c73..6fdf9db89b8dc4a74c007e6089bbe434394a39eb 100644 (file)
@@ -4,11 +4,5 @@ error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be ann
 LL |         WRAP_DIRECT_PARAM => { panic!("WRAP_DIRECT_PARAM matched itself"); }
    |         ^^^^^^^^^^^^^^^^^
 
-error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
-  --> $DIR/cant-hide-behind-direct-struct-param.rs:22:9
-   |
-LL |         WRAP_DIRECT_PARAM => { panic!("WRAP_DIRECT_PARAM matched itself"); }
-   |         ^^^^^^^^^^^^^^^^^
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
index 59141eac3e896037a62afb2bfb0b37e142bd9a41..1cca27520618d531e7ce2f964320e1c3f9ad1162 100644 (file)
@@ -12,7 +12,6 @@ fn main() {
     match y {
         FOO => { }
         //~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
-        //~| ERROR must be annotated with `#[derive(PartialEq, Eq)]`
         _ => { }
     }
 
index 1f26f0f11dc145300cd49cd99c87128eff13c33b..02fa23981894a07a307a9e87bd856b2768864883 100644 (file)
@@ -5,7 +5,7 @@ LL |         FOO => { }
    |         ^^^
 
 warning: floating-point types cannot be used in patterns
-  --> $DIR/match-forbidden-without-eq.rs:21:9
+  --> $DIR/match-forbidden-without-eq.rs:20:9
    |
 LL |         f32::INFINITY => { }
    |         ^^^^^^^^^^^^^
@@ -14,14 +14,8 @@ LL |         f32::INFINITY => { }
    = 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 #41620 <https://github.com/rust-lang/rust/issues/41620>
 
-error: to use a constant of type `Foo` in a pattern, `Foo` must be annotated with `#[derive(PartialEq, Eq)]`
-  --> $DIR/match-forbidden-without-eq.rs:13:9
-   |
-LL |         FOO => { }
-   |         ^^^
-
 warning: floating-point types cannot be used in patterns
-  --> $DIR/match-forbidden-without-eq.rs:21:9
+  --> $DIR/match-forbidden-without-eq.rs:20:9
    |
 LL |         f32::INFINITY => { }
    |         ^^^^^^^^^^^^^
@@ -29,5 +23,5 @@ LL |         f32::INFINITY => { }
    = 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 #41620 <https://github.com/rust-lang/rust/issues/41620>
 
-error: aborting due to 2 previous errors; 2 warnings emitted
+error: aborting due to previous error; 2 warnings emitted
 
index 4112e8f45179c633a380147dacff76cd096241e5..151a475c9190644e6423056229902d45b842e4f6 100644 (file)
@@ -15,6 +15,5 @@ fn main() {
     match [B(1)] {
         FOO => { }
         //~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
-        //~| ERROR must be annotated with `#[derive(PartialEq, Eq)]`
     }
 }
index 7e354bf9ade5aaed886f73c6249a9da3a69a7d83..371f8a0aa1d7745e6e47ed08873335bbe4a1d9ed 100644 (file)
@@ -4,11 +4,5 @@ error: to use a constant of type `B` in a pattern, `B` must be annotated with `#
 LL |         FOO => { }
    |         ^^^
 
-error: to use a constant of type `B` in a pattern, `B` must be annotated with `#[derive(PartialEq, Eq)]`
-  --> $DIR/match-nonempty-array-forbidden-without-eq.rs:16:9
-   |
-LL |         FOO => { }
-   |         ^^^
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
index 9530a1ffec453ff3e5bc550896e40fb460b0dbb2..6b7d94603b567d889aff97f257d49b29d09c257c 100644 (file)
@@ -16,7 +16,6 @@ fn main() {
     match y {
         FOO => { }
         //~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
-        //~| ERROR must be annotated with `#[derive(PartialEq, Eq)]`
         _ => { }
     }
 }
index 7ef082852ba8d159e7bee051a54a7b7fa3c4f5b1..4157cf65283e3d24ae23c88e23d5c9b9692f0716 100644 (file)
@@ -4,11 +4,5 @@ error: to use a constant of type `Foo` in a pattern, `Foo` must be annotated wit
 LL |         FOO => { }
    |         ^^^
 
-error: to use a constant of type `Foo` in a pattern, `Foo` must be annotated with `#[derive(PartialEq, Eq)]`
-  --> $DIR/match-requires-both-partialeq-and-eq.rs:17:9
-   |
-LL |         FOO => { }
-   |         ^^^
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
index 54fc4956b9b2825753922e574c900e6554db0224..d50835608fad1d03c74cd21ff4fabeda7aaeb691 100644 (file)
@@ -13,7 +13,6 @@ fn leak_free_test() {
     match todo!() {
         LEAK_FREE => (),
         //~^ `impl Send` cannot be used in patterns
-        //~| `impl Send` cannot be used in patterns
         _ => (),
     }
 }
index 90b44f6598df6647792101eaa1540f1d9f2e790d..889c4fd4b040556184b8dca4d8019f5486144b22 100644 (file)
@@ -4,11 +4,5 @@ error: `impl Send` cannot be used in patterns
 LL |         LEAK_FREE => (),
    |         ^^^^^^^^^
 
-error: `impl Send` cannot be used in patterns
-  --> $DIR/structural-match-no-leak.rs:14:9
-   |
-LL |         LEAK_FREE => (),
-   |         ^^^^^^^^^
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
index 5fe5bb4bdeaa83a9112589f97595b5a24390286b..a3ff4ad1d47054f238203ed5d2474497714540fd 100644 (file)
@@ -14,7 +14,6 @@ fn test() {
     match todo!() {
         VALUE => (),
         //~^ `impl Send` cannot be used in patterns
-        //~| `impl Send` cannot be used in patterns
         _ => (),
     }
 }
index 7aca3ba8640f14e033b392bb60a4bfe958ad977b..262fd0726137e63c9547b43ea4977c99070bd147 100644 (file)
@@ -4,11 +4,5 @@ error: `impl Send` cannot be used in patterns
 LL |         VALUE => (),
    |         ^^^^^
 
-error: `impl Send` cannot be used in patterns
-  --> $DIR/structural-match.rs:15:9
-   |
-LL |         VALUE => (),
-   |         ^^^^^
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
index cb2248cc6d18924f30e0b426022095f23af4933d..e7cb248a201acb8d0dffa58ca3a1cee2803d7613 100644 (file)
@@ -8,7 +8,6 @@ union U {
 fn main() {
     match C {
         C => {} //~ ERROR cannot use unions in constant patterns
-                //~| ERROR cannot use unions in constant patterns
         _ => {}
     }
 }
index bec720401b9e1aa7260ca88f200f397270f5312d..dc87f4de5219f445a8f25fabd598bcaab18fb592 100644 (file)
@@ -4,11 +4,5 @@ error: cannot use unions in constant patterns
 LL |         C => {}
    |         ^
 
-error: cannot use unions in constant patterns
-  --> $DIR/union-const-pat.rs:10:9
-   |
-LL |         C => {}
-   |         ^
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error