about summary refs log tree commit diff
path: root/tests/ui/pattern/usefulness
diff options
context:
space:
mode:
authorNadrieril <nadrieril+git@gmail.com>2023-11-16 04:28:22 +0100
committerNadrieril <nadrieril+git@gmail.com>2023-12-20 14:43:00 +0100
commit2a87bae48d415b9ced69ae52513f004d06e34283 (patch)
tree334838502abb7c78accdec2993522d6952878945 /tests/ui/pattern/usefulness
parent7e4924b55d25847bad6d4760a8484456c758ff52 (diff)
downloadrust-2a87bae48d415b9ced69ae52513f004d06e34283.tar.gz
rust-2a87bae48d415b9ced69ae52513f004d06e34283.zip
Reveal opaque types in exhaustiveness checking
Diffstat (limited to 'tests/ui/pattern/usefulness')
-rw-r--r--tests/ui/pattern/usefulness/impl-trait.rs10
-rw-r--r--tests/ui/pattern/usefulness/impl-trait.stderr38
2 files changed, 39 insertions, 9 deletions
diff --git a/tests/ui/pattern/usefulness/impl-trait.rs b/tests/ui/pattern/usefulness/impl-trait.rs
index 6fa28877b3e..6e8c0feb710 100644
--- a/tests/ui/pattern/usefulness/impl-trait.rs
+++ b/tests/ui/pattern/usefulness/impl-trait.rs
@@ -14,7 +14,7 @@ enum Void {}
 fn return_never_rpit(x: Void) -> impl Copy {
     if false {
         match return_never_rpit(x) {
-            _ => {}
+            _ => {} //~ ERROR unreachable
         }
     }
     x
@@ -28,7 +28,7 @@ type T = impl Copy;
 fn return_never_tait(x: Void) -> T {
     if false {
         match return_never_tait(x) {
-            _ => {}
+            _ => {} //~ ERROR unreachable
         }
     }
     x
@@ -42,7 +42,7 @@ fn option_never(x: Void) -> Option<impl Copy> {
     if false {
         match option_never(x) {
             None => {}
-            Some(_) => {}
+            Some(_) => {} //~ ERROR unreachable
         }
         match option_never(x) {
             None => {}
@@ -75,7 +75,7 @@ fn inner_never(x: Void) {
     type T = impl Copy;
     let y: T = x;
     match y {
-        _ => {}
+        _ => {} //~ ERROR unreachable
     }
 }
 
@@ -93,7 +93,7 @@ type U = impl Copy;
 fn unify_never(x: Void, u: U) -> U {
     if false {
         match u {
-            _ => {}
+            _ => {} //~ ERROR unreachable
         }
     }
     x
diff --git a/tests/ui/pattern/usefulness/impl-trait.stderr b/tests/ui/pattern/usefulness/impl-trait.stderr
index 6d7cef88d4f..df6d43dbb3f 100644
--- a/tests/ui/pattern/usefulness/impl-trait.stderr
+++ b/tests/ui/pattern/usefulness/impl-trait.stderr
@@ -1,8 +1,8 @@
 error: unreachable pattern
-  --> $DIR/impl-trait.rs:61:13
+  --> $DIR/impl-trait.rs:17:13
    |
-LL |             Some(_) => {}
-   |             ^^^^^^^
+LL |             _ => {}
+   |             ^
    |
 note: the lint level is defined here
   --> $DIR/impl-trait.rs:5:9
@@ -11,12 +11,36 @@ LL | #![deny(unreachable_patterns)]
    |         ^^^^^^^^^^^^^^^^^^^^
 
 error: unreachable pattern
+  --> $DIR/impl-trait.rs:31:13
+   |
+LL |             _ => {}
+   |             ^
+
+error: unreachable pattern
+  --> $DIR/impl-trait.rs:45:13
+   |
+LL |             Some(_) => {}
+   |             ^^^^^^^
+
+error: unreachable pattern
+  --> $DIR/impl-trait.rs:61:13
+   |
+LL |             Some(_) => {}
+   |             ^^^^^^^
+
+error: unreachable pattern
   --> $DIR/impl-trait.rs:65:13
    |
 LL |             _ => {}
    |             ^
 
 error: unreachable pattern
+  --> $DIR/impl-trait.rs:78:9
+   |
+LL |         _ => {}
+   |         ^
+
+error: unreachable pattern
   --> $DIR/impl-trait.rs:88:9
    |
 LL |         _ => {}
@@ -25,6 +49,12 @@ LL |         Some((a, b)) => {}
    |         ^^^^^^^^^^^^ unreachable pattern
 
 error: unreachable pattern
+  --> $DIR/impl-trait.rs:96:13
+   |
+LL |             _ => {}
+   |             ^
+
+error: unreachable pattern
   --> $DIR/impl-trait.rs:107:9
    |
 LL |         Some((mut x, mut y)) => {
@@ -66,6 +96,6 @@ LL +         _ => todo!(),
 LL +     }
    |
 
-error: aborting due to 7 previous errors
+error: aborting due to 12 previous errors
 
 For more information about this error, try `rustc --explain E0004`.