about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNadrieril <nadrieril+git@gmail.com>2024-01-16 16:39:38 +0100
committerNadrieril <nadrieril+git@gmail.com>2024-01-18 21:15:25 +0100
commitff6fa67a9dd61cafe44446ff2910e14ad78584c2 (patch)
tree34f02bcdabbfe220df815d4b1e4ac6dab67a2bf3
parentd8b72e796e4e2bc31701e2197c4bc6f324adbf64 (diff)
downloadrust-ff6fa67a9dd61cafe44446ff2910e14ad78584c2.tar.gz
rust-ff6fa67a9dd61cafe44446ff2910e14ad78584c2.zip
Split-off the passing tests to ensure they pass
-rw-r--r--tests/ui/rfcs/rfc-0000-never_patterns/typeck.fail.stderr (renamed from tests/ui/rfcs/rfc-0000-never_patterns/typeck.stderr)16
-rw-r--r--tests/ui/rfcs/rfc-0000-never_patterns/typeck.rs25
2 files changed, 24 insertions, 17 deletions
diff --git a/tests/ui/rfcs/rfc-0000-never_patterns/typeck.stderr b/tests/ui/rfcs/rfc-0000-never_patterns/typeck.fail.stderr
index 8c0475894de..013a8b53a55 100644
--- a/tests/ui/rfcs/rfc-0000-never_patterns/typeck.stderr
+++ b/tests/ui/rfcs/rfc-0000-never_patterns/typeck.fail.stderr
@@ -1,5 +1,5 @@
 error: mismatched types
-  --> $DIR/typeck.rs:21:9
+  --> $DIR/typeck.rs:25:9
    |
 LL |         !,
    |         ^ a never pattern must be used on an uninhabited type
@@ -7,7 +7,7 @@ LL |         !,
    = note: the matched value is of type `()`
 
 error: mismatched types
-  --> $DIR/typeck.rs:25:9
+  --> $DIR/typeck.rs:29:9
    |
 LL |         !,
    |         ^ a never pattern must be used on an uninhabited type
@@ -15,7 +15,7 @@ LL |         !,
    = note: the matched value is of type `(i32, bool)`
 
 error: mismatched types
-  --> $DIR/typeck.rs:29:13
+  --> $DIR/typeck.rs:33:13
    |
 LL |         (_, !),
    |             ^ a never pattern must be used on an uninhabited type
@@ -23,7 +23,7 @@ LL |         (_, !),
    = note: the matched value is of type `bool`
 
 error: mismatched types
-  --> $DIR/typeck.rs:34:14
+  --> $DIR/typeck.rs:38:14
    |
 LL |         Some(!),
    |              ^ a never pattern must be used on an uninhabited type
@@ -31,7 +31,7 @@ LL |         Some(!),
    = note: the matched value is of type `i32`
 
 error: mismatched types
-  --> $DIR/typeck.rs:41:9
+  --> $DIR/typeck.rs:45:9
    |
 LL |         !,
    |         ^ a never pattern must be used on an uninhabited type
@@ -39,7 +39,7 @@ LL |         !,
    = note: the matched value is of type `()`
 
 error: mismatched types
-  --> $DIR/typeck.rs:48:9
+  --> $DIR/typeck.rs:52:9
    |
 LL |         !,
    |         ^ a never pattern must be used on an uninhabited type
@@ -47,7 +47,7 @@ LL |         !,
    = note: the matched value is of type `Option<Void>`
 
 error: mismatched types
-  --> $DIR/typeck.rs:53:9
+  --> $DIR/typeck.rs:57:9
    |
 LL |         !,
    |         ^ a never pattern must be used on an uninhabited type
@@ -55,7 +55,7 @@ LL |         !,
    = note: the matched value is of type `[Void]`
 
 error: mismatched types
-  --> $DIR/typeck.rs:59:9
+  --> $DIR/typeck.rs:63:9
    |
 LL |         !,
    |         ^ a never pattern must be used on an uninhabited type
diff --git a/tests/ui/rfcs/rfc-0000-never_patterns/typeck.rs b/tests/ui/rfcs/rfc-0000-never_patterns/typeck.rs
index 333108e92c0..31a23fa002c 100644
--- a/tests/ui/rfcs/rfc-0000-never_patterns/typeck.rs
+++ b/tests/ui/rfcs/rfc-0000-never_patterns/typeck.rs
@@ -1,3 +1,6 @@
+// revisions: pass fail
+//[pass] check-pass
+//[fail] check-fail
 #![feature(never_patterns)]
 #![feature(exhaustive_patterns)]
 #![allow(incomplete_features)]
@@ -15,51 +18,55 @@ fn safe_unwrap_result<T: Copy>(res: Result<T, Void>) {
 }
 
 // Check we only accept `!` where we want to.
-fn never_pattern_typeck(void: Void) {
+#[cfg(fail)]
+fn never_pattern_typeck_fail(void: Void) {
     // Don't accept on a non-empty type.
     match () {
         !,
-        //~^ ERROR: mismatched types
+        //[fail]~^ ERROR: mismatched types
     }
     match (0, false) {
         !,
-        //~^ ERROR: mismatched types
+        //[fail]~^ ERROR: mismatched types
     }
     match (0, false) {
         (_, !),
-        //~^ ERROR: mismatched types
+        //[fail]~^ ERROR: mismatched types
     }
     match Some(0) {
         None => {}
         Some(!),
-        //~^ ERROR: mismatched types
+        //[fail]~^ ERROR: mismatched types
     }
 
     // Don't accept on an arbitrary type, even if there are no more branches.
     match () {
         () => {}
         !,
-        //~^ ERROR: mismatched types
+        //[fail]~^ ERROR: mismatched types
     }
 
     // Don't accept even on an empty branch.
     match None::<Void> {
         None => {}
         !,
-        //~^ ERROR: mismatched types
+        //[fail]~^ ERROR: mismatched types
     }
     match (&[] as &[Void]) {
         [] => {}
         !,
-        //~^ ERROR: mismatched types
+        //[fail]~^ ERROR: mismatched types
     }
     // Let alone if the emptiness is behind a reference.
     match None::<&Void> {
         None => {}
         !,
-        //~^ ERROR: mismatched types
+        //[fail]~^ ERROR: mismatched types
     }
+}
 
+#[cfg(pass)]
+fn never_pattern_typeck_pass(void: Void) {
     // Participate in match ergonomics.
     match &void {
         !,