diff options
Diffstat (limited to '')
-rw-r--r-- | tests/ui/uninhabited/exhaustive-wo-nevertype-issue-51221.rs (renamed from src/test/ui/uninhabited/exhaustive-wo-nevertype-issue-51221.rs) | 0 | ||||
-rw-r--r-- | tests/ui/uninhabited/privately-uninhabited-dead-code.rs (renamed from src/test/ui/uninhabited/privately-uninhabited-dead-code.rs) | 0 | ||||
-rw-r--r-- | tests/ui/uninhabited/privately-uninhabited-mir-call.rs (renamed from src/test/ui/uninhabited/privately-uninhabited-mir-call.rs) | 0 | ||||
-rw-r--r-- | tests/ui/uninhabited/privately-uninhabited-mir-call.stderr (renamed from src/test/ui/uninhabited/privately-uninhabited-mir-call.stderr) | 0 | ||||
-rw-r--r-- | tests/ui/uninhabited/uninhabited-enum-cast.rs (renamed from src/test/ui/uninhabited/uninhabited-enum-cast.rs) | 0 | ||||
-rw-r--r-- | tests/ui/uninhabited/uninhabited-irrefutable.rs (renamed from src/test/ui/uninhabited/uninhabited-irrefutable.rs) | 4 | ||||
-rw-r--r-- | tests/ui/uninhabited/uninhabited-irrefutable.stderr | 24 | ||||
-rw-r--r-- | tests/ui/uninhabited/uninhabited-matches-feature-gated.rs (renamed from src/test/ui/uninhabited/uninhabited-matches-feature-gated.rs) | 0 | ||||
-rw-r--r-- | tests/ui/uninhabited/uninhabited-matches-feature-gated.stderr (renamed from src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr) | 30 | ||||
-rw-r--r-- | tests/ui/uninhabited/uninhabited-patterns.rs (renamed from src/test/ui/uninhabited/uninhabited-patterns.rs) | 0 | ||||
-rw-r--r-- | tests/ui/uninhabited/uninhabited-patterns.stderr (renamed from src/test/ui/uninhabited/uninhabited-patterns.stderr) | 0 |
11 files changed, 33 insertions, 25 deletions
diff --git a/src/test/ui/uninhabited/exhaustive-wo-nevertype-issue-51221.rs b/tests/ui/uninhabited/exhaustive-wo-nevertype-issue-51221.rs index b59432078..b59432078 100644 --- a/src/test/ui/uninhabited/exhaustive-wo-nevertype-issue-51221.rs +++ b/tests/ui/uninhabited/exhaustive-wo-nevertype-issue-51221.rs diff --git a/src/test/ui/uninhabited/privately-uninhabited-dead-code.rs b/tests/ui/uninhabited/privately-uninhabited-dead-code.rs index f476704cd..f476704cd 100644 --- a/src/test/ui/uninhabited/privately-uninhabited-dead-code.rs +++ b/tests/ui/uninhabited/privately-uninhabited-dead-code.rs diff --git a/src/test/ui/uninhabited/privately-uninhabited-mir-call.rs b/tests/ui/uninhabited/privately-uninhabited-mir-call.rs index 2764bb563..2764bb563 100644 --- a/src/test/ui/uninhabited/privately-uninhabited-mir-call.rs +++ b/tests/ui/uninhabited/privately-uninhabited-mir-call.rs diff --git a/src/test/ui/uninhabited/privately-uninhabited-mir-call.stderr b/tests/ui/uninhabited/privately-uninhabited-mir-call.stderr index 0dfd22a30..0dfd22a30 100644 --- a/src/test/ui/uninhabited/privately-uninhabited-mir-call.stderr +++ b/tests/ui/uninhabited/privately-uninhabited-mir-call.stderr diff --git a/src/test/ui/uninhabited/uninhabited-enum-cast.rs b/tests/ui/uninhabited/uninhabited-enum-cast.rs index 5a75c94c4..5a75c94c4 100644 --- a/src/test/ui/uninhabited/uninhabited-enum-cast.rs +++ b/tests/ui/uninhabited/uninhabited-enum-cast.rs diff --git a/src/test/ui/uninhabited/uninhabited-irrefutable.rs b/tests/ui/uninhabited/uninhabited-irrefutable.rs index 1a0f3c5e5..4b001aca2 100644 --- a/src/test/ui/uninhabited/uninhabited-irrefutable.rs +++ b/tests/ui/uninhabited/uninhabited-irrefutable.rs @@ -24,5 +24,7 @@ enum Foo { fn main() { let x: Foo = Foo::D(123, 456); - let Foo::D(_y, _z) = x; //~ ERROR refutable pattern in local binding: `Foo::A(_)` not covered + let Foo::D(_y, _z) = x; + //~^ ERROR refutable pattern in local binding + //~| `Foo::A(_)` not covered } diff --git a/tests/ui/uninhabited/uninhabited-irrefutable.stderr b/tests/ui/uninhabited/uninhabited-irrefutable.stderr new file mode 100644 index 000000000..8cafea555 --- /dev/null +++ b/tests/ui/uninhabited/uninhabited-irrefutable.stderr @@ -0,0 +1,24 @@ +error[E0005]: refutable pattern in local binding + --> $DIR/uninhabited-irrefutable.rs:27:9 + | +LL | let Foo::D(_y, _z) = x; + | ^^^^^^^^^^^^^^ pattern `Foo::A(_)` not covered + | + = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant + = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html +note: `Foo` defined here + --> $DIR/uninhabited-irrefutable.rs:18:6 + | +LL | enum Foo { + | ^^^ +LL | A(foo::SecretlyEmpty), + | - not covered + = note: the matched value is of type `Foo` +help: you might want to use `let else` to handle the variant that isn't matched + | +LL | let Foo::D(_y, _z) = x else { todo!() }; + | ++++++++++++++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0005`. diff --git a/src/test/ui/uninhabited/uninhabited-matches-feature-gated.rs b/tests/ui/uninhabited/uninhabited-matches-feature-gated.rs index e804afcf9..e804afcf9 100644 --- a/src/test/ui/uninhabited/uninhabited-matches-feature-gated.rs +++ b/tests/ui/uninhabited/uninhabited-matches-feature-gated.rs diff --git a/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr b/tests/ui/uninhabited/uninhabited-matches-feature-gated.stderr index c78829634..466d7f2ea 100644 --- a/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr +++ b/tests/ui/uninhabited/uninhabited-matches-feature-gated.stderr @@ -6,12 +6,9 @@ LL | let _ = match x { | note: `Result<u32, &Void>` defined here --> $SRC_DIR/core/src/result.rs:LL:COL + ::: $SRC_DIR/core/src/result.rs:LL:COL | -LL | pub enum Result<T, E> { - | --------------------- -... -LL | Err(#[stable(feature = "rust1", since = "1.0.0")] E), - | ^^^ not covered + = note: not covered = note: the matched value is of type `Result<u32, &Void>` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | @@ -88,12 +85,9 @@ LL | let _ = match x { | note: `Result<u32, Void>` defined here --> $SRC_DIR/core/src/result.rs:LL:COL + ::: $SRC_DIR/core/src/result.rs:LL:COL | -LL | pub enum Result<T, E> { - | --------------------- -... -LL | Err(#[stable(feature = "rust1", since = "1.0.0")] E), - | ^^^ not covered + = note: not covered = note: the matched value is of type `Result<u32, Void>` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | @@ -101,7 +95,7 @@ LL ~ Ok(x) => x, LL ~ Err(_) => todo!(), | -error[E0005]: refutable pattern in local binding: `Err(_)` not covered +error[E0005]: refutable pattern in local binding --> $DIR/uninhabited-matches-feature-gated.rs:37:9 | LL | let Ok(x) = x; @@ -109,20 +103,8 @@ LL | let Ok(x) = x; | = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html -note: `Result<u32, Void>` defined here - --> $SRC_DIR/core/src/result.rs:LL:COL - | -LL | pub enum Result<T, E> { - | --------------------- -... -LL | Err(#[stable(feature = "rust1", since = "1.0.0")] E), - | ^^^ not covered = note: the matched value is of type `Result<u32, Void>` -help: you might want to use `if let` to ignore the variant that isn't matched - | -LL | let x = if let Ok(x) = x { x } else { todo!() }; - | ++++++++++ ++++++++++++++++++++++ -help: alternatively, you might want to use let else to handle the variant that isn't matched +help: you might want to use `let else` to handle the variant that isn't matched | LL | let Ok(x) = x else { todo!() }; | ++++++++++++++++ diff --git a/src/test/ui/uninhabited/uninhabited-patterns.rs b/tests/ui/uninhabited/uninhabited-patterns.rs index f1573b6ad..f1573b6ad 100644 --- a/src/test/ui/uninhabited/uninhabited-patterns.rs +++ b/tests/ui/uninhabited/uninhabited-patterns.rs diff --git a/src/test/ui/uninhabited/uninhabited-patterns.stderr b/tests/ui/uninhabited/uninhabited-patterns.stderr index 655569ad6..655569ad6 100644 --- a/src/test/ui/uninhabited/uninhabited-patterns.stderr +++ b/tests/ui/uninhabited/uninhabited-patterns.stderr |