about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/uninhabited/uninhabited-unstable-field.current.stderr43
-rw-r--r--tests/ui/uninhabited/uninhabited-unstable-field.exhaustive.stderr43
-rw-r--r--tests/ui/uninhabited/uninhabited-unstable-field.rs17
-rw-r--r--tests/ui/uninhabited/uninhabited-unstable-field.stderr40
4 files changed, 49 insertions, 94 deletions
diff --git a/tests/ui/uninhabited/uninhabited-unstable-field.current.stderr b/tests/ui/uninhabited/uninhabited-unstable-field.current.stderr
deleted file mode 100644
index 704475ece48..00000000000
--- a/tests/ui/uninhabited/uninhabited-unstable-field.current.stderr
+++ /dev/null
@@ -1,43 +0,0 @@
-error[E0004]: non-exhaustive patterns: type `Foo<Void>` is non-empty
-  --> $DIR/uninhabited-unstable-field.rs:15:11
-   |
-LL |     match x {}
-   |           ^
-   |
-note: `Foo<Void>` defined here
-  --> $DIR/auxiliary/staged-api.rs:5:1
-   |
-LL | pub struct Foo<T> {
-   | ^^^^^^^^^^^^^^^^^
-   = note: the matched value is of type `Foo<Void>`
-help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown
-   |
-LL ~     match x {
-LL +         _ => todo!(),
-LL ~     }
-   |
-
-error[E0004]: non-exhaustive patterns: `MyCoroutineState::Complete(_)` not covered
-  --> $DIR/uninhabited-unstable-field.rs:34:11
-   |
-LL |     match x {
-   |           ^ pattern `MyCoroutineState::Complete(_)` not covered
-   |
-note: `MyCoroutineState<i32, !>` defined here
-  --> $DIR/auxiliary/staged-api.rs:11:1
-   |
-LL | pub enum MyCoroutineState<Y, R> {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-LL |     Yielded(Y),
-LL |     Complete(R),
-   |     -------- not covered
-   = note: the matched value is of type `MyCoroutineState<i32, !>`
-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 ~         MyCoroutineState::Yielded(_) => {},
-LL +         MyCoroutineState::Complete(_) => todo!()
-   |
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0004`.
diff --git a/tests/ui/uninhabited/uninhabited-unstable-field.exhaustive.stderr b/tests/ui/uninhabited/uninhabited-unstable-field.exhaustive.stderr
deleted file mode 100644
index 704475ece48..00000000000
--- a/tests/ui/uninhabited/uninhabited-unstable-field.exhaustive.stderr
+++ /dev/null
@@ -1,43 +0,0 @@
-error[E0004]: non-exhaustive patterns: type `Foo<Void>` is non-empty
-  --> $DIR/uninhabited-unstable-field.rs:15:11
-   |
-LL |     match x {}
-   |           ^
-   |
-note: `Foo<Void>` defined here
-  --> $DIR/auxiliary/staged-api.rs:5:1
-   |
-LL | pub struct Foo<T> {
-   | ^^^^^^^^^^^^^^^^^
-   = note: the matched value is of type `Foo<Void>`
-help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown
-   |
-LL ~     match x {
-LL +         _ => todo!(),
-LL ~     }
-   |
-
-error[E0004]: non-exhaustive patterns: `MyCoroutineState::Complete(_)` not covered
-  --> $DIR/uninhabited-unstable-field.rs:34:11
-   |
-LL |     match x {
-   |           ^ pattern `MyCoroutineState::Complete(_)` not covered
-   |
-note: `MyCoroutineState<i32, !>` defined here
-  --> $DIR/auxiliary/staged-api.rs:11:1
-   |
-LL | pub enum MyCoroutineState<Y, R> {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-LL |     Yielded(Y),
-LL |     Complete(R),
-   |     -------- not covered
-   = note: the matched value is of type `MyCoroutineState<i32, !>`
-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 ~         MyCoroutineState::Yielded(_) => {},
-LL +         MyCoroutineState::Complete(_) => todo!()
-   |
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0004`.
diff --git a/tests/ui/uninhabited/uninhabited-unstable-field.rs b/tests/ui/uninhabited/uninhabited-unstable-field.rs
index 44527319ffd..321b864aa27 100644
--- a/tests/ui/uninhabited/uninhabited-unstable-field.rs
+++ b/tests/ui/uninhabited/uninhabited-unstable-field.rs
@@ -1,6 +1,9 @@
 //@ aux-build: staged-api.rs
-//@ revisions: current exhaustive
-#![cfg_attr(exhaustive, feature(exhaustive_patterns))]
+//! The field of `Pin` used to be public, which would cause `Pin<Void>` to be uninhabited. To remedy
+//! this, we temporarily made it so unstable fields are always considered inhabited. This has now
+//! been reverted, and this file ensures that we don't special-case unstable fields wrt
+//! inhabitedness anymore.
+#![feature(exhaustive_patterns)]
 #![feature(never_type)]
 #![feature(my_coro_state)] // Custom feature from `staged-api.rs`
 #![deny(unreachable_patterns)]
@@ -13,31 +16,29 @@ enum Void {}
 
 fn demo(x: Foo<Void>) {
     match x {}
-    //~^ ERROR non-exhaustive patterns
 }
 
-// Ensure that the pattern is not considered unreachable.
+// Ensure that the pattern is considered unreachable.
 fn demo2(x: Foo<Void>) {
     match x {
-        Foo { .. } => {}
+        Foo { .. } => {} //~ ERROR unreachable
     }
 }
 
 // Same as above, but for wildcard.
 fn demo3(x: Foo<Void>) {
     match x {
-        _ => {}
+        _ => {} //~ ERROR unreachable
     }
 }
 
 fn unstable_enum(x: MyCoroutineState<i32, !>) {
     match x {
-        //~^ ERROR non-exhaustive patterns
         MyCoroutineState::Yielded(_) => {}
     }
     match x {
         MyCoroutineState::Yielded(_) => {}
-        MyCoroutineState::Complete(_) => {}
+        MyCoroutineState::Complete(_) => {} //~ ERROR unreachable
     }
 }
 
diff --git a/tests/ui/uninhabited/uninhabited-unstable-field.stderr b/tests/ui/uninhabited/uninhabited-unstable-field.stderr
new file mode 100644
index 00000000000..a0c9f9366a6
--- /dev/null
+++ b/tests/ui/uninhabited/uninhabited-unstable-field.stderr
@@ -0,0 +1,40 @@
+error: unreachable pattern
+  --> $DIR/uninhabited-unstable-field.rs:24:9
+   |
+LL |         Foo { .. } => {}
+   |         ^^^^^^^^^^------
+   |         |
+   |         matches no values because `Foo<Void>` is uninhabited
+   |         help: remove the match arm
+   |
+   = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
+note: the lint level is defined here
+  --> $DIR/uninhabited-unstable-field.rs:9:9
+   |
+LL | #![deny(unreachable_patterns)]
+   |         ^^^^^^^^^^^^^^^^^^^^
+
+error: unreachable pattern
+  --> $DIR/uninhabited-unstable-field.rs:31:9
+   |
+LL |         _ => {}
+   |         ^------
+   |         |
+   |         matches no values because `Foo<Void>` is uninhabited
+   |         help: remove the match arm
+   |
+   = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
+
+error: unreachable pattern
+  --> $DIR/uninhabited-unstable-field.rs:41:9
+   |
+LL |         MyCoroutineState::Complete(_) => {}
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^------
+   |         |
+   |         matches no values because `!` is uninhabited
+   |         help: remove the match arm
+   |
+   = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
+
+error: aborting due to 3 previous errors
+