1
Fork 0

Update tests

This commit is contained in:
Nadrieril 2024-07-27 11:08:16 +02:00
parent cd40769c02
commit 99468bb760
72 changed files with 948 additions and 911 deletions

View file

@ -13,17 +13,17 @@ fn opt1(_1: &Result<u32, Void>) -> &u32 {
bb0: { bb0: {
PlaceMention(_1); PlaceMention(_1);
_2 = discriminant((*_1)); falseEdge -> [real: bb4, imaginary: bb1];
switchInt(move _2) -> [0: bb2, 1: bb3, otherwise: bb1];
} }
bb1: { bb1: {
FakeRead(ForMatchedPlace(None), _1); _2 = discriminant((*_1));
unreachable; switchInt(move _2) -> [1: bb3, otherwise: bb2];
} }
bb2: { bb2: {
falseEdge -> [real: bb4, imaginary: bb3]; FakeRead(ForMatchedPlace(None), _1);
unreachable;
} }
bb3: { bb3: {

View file

@ -11,25 +11,10 @@ fn opt2(_1: &Result<u32, Void>) -> &u32 {
bb0: { bb0: {
PlaceMention(_1); PlaceMention(_1);
_2 = discriminant((*_1));
switchInt(move _2) -> [0: bb2, 1: bb3, otherwise: bb1];
}
bb1: {
FakeRead(ForMatchedPlace(None), _1);
unreachable;
}
bb2: {
StorageLive(_3); StorageLive(_3);
_3 = &(((*_1) as Ok).0: u32); _3 = &(((*_1) as Ok).0: u32);
_0 = &(*_3); _0 = &(*_3);
StorageDead(_3); StorageDead(_3);
return; return;
} }
bb3: {
FakeRead(ForMatchedPlace(None), (((*_1) as Err).0: Void));
unreachable;
}
} }

View file

@ -12,24 +12,19 @@ fn opt3(_1: &Result<u32, Void>) -> &u32 {
bb0: { bb0: {
PlaceMention(_1); PlaceMention(_1);
_2 = discriminant((*_1)); _2 = discriminant((*_1));
switchInt(move _2) -> [0: bb3, 1: bb2, otherwise: bb1]; switchInt(move _2) -> [1: bb2, otherwise: bb1];
} }
bb1: { bb1: {
FakeRead(ForMatchedPlace(None), _1);
unreachable;
}
bb2: {
FakeRead(ForMatchedPlace(None), (((*_1) as Err).0: Void));
unreachable;
}
bb3: {
StorageLive(_3); StorageLive(_3);
_3 = &(((*_1) as Ok).0: u32); _3 = &(((*_1) as Ok).0: u32);
_0 = &(*_3); _0 = &(*_3);
StorageDead(_3); StorageDead(_3);
return; return;
} }
bb2: {
FakeRead(ForMatchedPlace(None), (((*_1) as Err).0: Void));
unreachable;
}
} }

View file

@ -19,14 +19,16 @@
bb1: { bb1: {
_2 = discriminant(_1); _2 = discriminant(_1);
- switchInt(move _2) -> [0: bb4, 1: bb3, otherwise: bb2]; - switchInt(move _2) -> [1: bb3, otherwise: bb2];
+ _5 = Eq(_2, const 0_isize); + _5 = Ne(_2, const 1_isize);
+ assume(move _5); + assume(move _5);
+ goto -> bb4; + goto -> bb2;
} }
bb2: { bb2: {
unreachable; _0 = const ();
StorageDead(_1);
return;
} }
bb3: { bb3: {
@ -35,11 +37,5 @@
- StorageLive(_4); - StorageLive(_4);
unreachable; unreachable;
} }
bb4: {
_0 = const ();
StorageDead(_1);
return;
}
} }

View file

@ -19,14 +19,16 @@
bb1: { bb1: {
_2 = discriminant(_1); _2 = discriminant(_1);
- switchInt(move _2) -> [0: bb4, 1: bb3, otherwise: bb2]; - switchInt(move _2) -> [1: bb3, otherwise: bb2];
+ _5 = Eq(_2, const 0_isize); + _5 = Ne(_2, const 1_isize);
+ assume(move _5); + assume(move _5);
+ goto -> bb4; + goto -> bb2;
} }
bb2: { bb2: {
unreachable; _0 = const ();
StorageDead(_1);
return;
} }
bb3: { bb3: {
@ -35,11 +37,5 @@
- StorageLive(_4); - StorageLive(_4);
unreachable; unreachable;
} }
bb4: {
_0 = const ();
StorageDead(_1);
return;
}
} }

View file

@ -45,18 +45,16 @@ fn as_match() {
// CHECK: bb0: { // CHECK: bb0: {
// CHECK: {{_.*}} = empty() // CHECK: {{_.*}} = empty()
// CHECK: bb1: { // CHECK: bb1: {
// CHECK: [[eq:_.*]] = Eq({{.*}}, const 0_isize); // CHECK: [[eq:_.*]] = Ne({{.*}}, const 1_isize);
// CHECK-NEXT: assume(move [[eq]]); // CHECK-NEXT: assume(move [[eq]]);
// CHECK-NEXT: goto -> bb4; // CHECK-NEXT: goto -> bb2;
// CHECK: bb2: { // CHECK: bb2: {
// CHECK-NEXT: unreachable; // CHECK: return;
// CHECK: bb3: { // CHECK: bb3: {
// CHECK-NEXT: unreachable; // CHECK-NEXT: unreachable;
// CHECK: bb4: {
// CHECK: return;
match empty() { match empty() {
None => {}
Some(_x) => match _x {}, Some(_x) => match _x {},
None => {}
} }
} }

View file

@ -49,7 +49,7 @@ struct Plop {
fn simple() { fn simple() {
// CHECK-LABEL: fn simple( // CHECK-LABEL: fn simple(
// CHECK: [[discr:_.*]] = discriminant( // CHECK: [[discr:_.*]] = discriminant(
// CHECK: switchInt(move [[discr]]) -> [0: [[unreachable:bb.*]], 1: [[unreachable]], 2: bb2, otherwise: [[unreachable]]]; // CHECK: switchInt(move [[discr]]) -> [0: [[unreachable:bb.*]], 1: [[unreachable]], 2: bb1, otherwise: [[unreachable]]];
// CHECK: [[unreachable]]: { // CHECK: [[unreachable]]: {
// CHECK-NEXT: unreachable; // CHECK-NEXT: unreachable;
match Test1::C { match Test1::C {

View file

@ -14,40 +14,40 @@
StorageLive(_2); StorageLive(_2);
_2 = Test1::C; _2 = Test1::C;
_3 = discriminant(_2); _3 = discriminant(_2);
- switchInt(move _3) -> [0: bb4, 1: bb3, 2: bb2, otherwise: bb1]; - switchInt(move _3) -> [0: bb3, 1: bb2, otherwise: bb1];
+ switchInt(move _3) -> [0: bb1, 1: bb1, 2: bb2, otherwise: bb1]; + switchInt(move _3) -> [0: bb5, 1: bb5, 2: bb1, otherwise: bb5];
} }
bb1: { bb1: {
unreachable;
}
bb2: {
StorageLive(_5); StorageLive(_5);
_5 = const "C"; _5 = const "C";
_1 = &(*_5); _1 = &(*_5);
StorageDead(_5); StorageDead(_5);
goto -> bb5; goto -> bb4;
} }
bb3: { bb2: {
StorageLive(_4); StorageLive(_4);
_4 = const "B(Empty)"; _4 = const "B(Empty)";
_1 = &(*_4); _1 = &(*_4);
StorageDead(_4); StorageDead(_4);
goto -> bb5; goto -> bb4;
}
bb3: {
_1 = const "A(Empty)";
goto -> bb4;
} }
bb4: { bb4: {
_1 = const "A(Empty)";
goto -> bb5;
}
bb5: {
StorageDead(_2); StorageDead(_2);
StorageDead(_1); StorageDead(_1);
_0 = const (); _0 = const ();
return; return;
+ }
+
+ bb5: {
+ unreachable;
} }
} }

View file

@ -14,40 +14,40 @@
StorageLive(_2); StorageLive(_2);
_2 = Test1::C; _2 = Test1::C;
_3 = discriminant(_2); _3 = discriminant(_2);
- switchInt(move _3) -> [0: bb4, 1: bb3, 2: bb2, otherwise: bb1]; - switchInt(move _3) -> [0: bb3, 1: bb2, otherwise: bb1];
+ switchInt(move _3) -> [0: bb1, 1: bb1, 2: bb2, otherwise: bb1]; + switchInt(move _3) -> [0: bb5, 1: bb5, 2: bb1, otherwise: bb5];
} }
bb1: { bb1: {
unreachable;
}
bb2: {
StorageLive(_5); StorageLive(_5);
_5 = const "C"; _5 = const "C";
_1 = &(*_5); _1 = &(*_5);
StorageDead(_5); StorageDead(_5);
goto -> bb5; goto -> bb4;
} }
bb3: { bb2: {
StorageLive(_4); StorageLive(_4);
_4 = const "B(Empty)"; _4 = const "B(Empty)";
_1 = &(*_4); _1 = &(*_4);
StorageDead(_4); StorageDead(_4);
goto -> bb5; goto -> bb4;
}
bb3: {
_1 = const "A(Empty)";
goto -> bb4;
} }
bb4: { bb4: {
_1 = const "A(Empty)";
goto -> bb5;
}
bb5: {
StorageDead(_2); StorageDead(_2);
StorageDead(_1); StorageDead(_1);
_0 = const (); _0 = const ();
return; return;
+ }
+
+ bb5: {
+ unreachable;
} }
} }

View file

@ -1,10 +1,9 @@
// Test precise capture of a multi-variant enum (when remaining variants are // Test precise capture of a multi-variant enum (when remaining variants are
// visibly uninhabited). // visibly uninhabited).
//@ revisions: min_exhaustive_patterns exhaustive_patterns //@ revisions: normal exhaustive_patterns
//@ edition:2021 //@ edition:2021
//@ run-pass //@ run-pass
#![cfg_attr(exhaustive_patterns, feature(exhaustive_patterns))] #![cfg_attr(exhaustive_patterns, feature(exhaustive_patterns))]
#![cfg_attr(min_exhaustive_patterns, feature(min_exhaustive_patterns))]
#![feature(never_type)] #![feature(never_type)]
pub fn main() { pub fn main() {

View file

@ -1,4 +1,4 @@
<svg width="740px" height="848px" xmlns="http://www.w3.org/2000/svg"> <svg width="818px" height="848px" xmlns="http://www.w3.org/2000/svg">
<style> <style>
.fg { fill: #AAAAAA } .fg { fill: #AAAAAA }
.bg { background: #000000 } .bg { background: #000000 }

Before

Width:  |  Height:  |  Size: 8.9 KiB

After

Width:  |  Height:  |  Size: 8.9 KiB

Before After
Before After

View file

@ -1,8 +1,8 @@
//@ run-pass //@ run-pass
#![allow(unreachable_patterns)]
#![allow(dead_code)] #![allow(dead_code)]
enum Empty { } enum Empty {}
enum Test1 { enum Test1 {
A(u8), A(u8),
B(Empty), B(Empty),

View file

@ -1,4 +1,5 @@
//@ run-pass //@ run-pass
#![allow(unreachable_patterns)]
pub enum Infallible {} pub enum Infallible {}

View file

@ -1,4 +1,5 @@
//@ run-pass //@ run-pass
#![allow(unreachable_patterns)]
//! Make sure that we read and write enum discriminants correctly for corner cases caused //! Make sure that we read and write enum discriminants correctly for corner cases caused
//! by layout optimizations. //! by layout optimizations.

View file

@ -5,5 +5,5 @@ fn foo() -> Result<u32, !> {
} }
fn main() { fn main() {
let Ok(_x) = foo(); //~ ERROR refutable pattern in local binding let Ok(_x) = &foo(); //~ ERROR refutable pattern in local binding
} }

View file

@ -1,16 +1,16 @@
error[E0005]: refutable pattern in local binding error[E0005]: refutable pattern in local binding
--> $DIR/feature-gate-exhaustive-patterns.rs:8:9 --> $DIR/feature-gate-exhaustive-patterns.rs:8:9
| |
LL | let Ok(_x) = foo(); LL | let Ok(_x) = &foo();
| ^^^^^^ pattern `Err(_)` not covered | ^^^^^^ pattern `&Err(_)` not covered
| |
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = 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: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
= note: the matched value is of type `Result<u32, !>` = note: the matched value is of type `&Result<u32, !>`
help: 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) = foo() else { todo!() }; LL | let Ok(_x) = &foo() else { todo!() };
| ++++++++++++++++ | ++++++++++++++++
error: aborting due to 1 previous error error: aborting due to 1 previous error

View file

@ -2,9 +2,8 @@
#![allow(unused_variables)] #![allow(unused_variables)]
#![allow(unreachable_code)] #![allow(unreachable_code)]
#![allow(unreachable_patterns)]
// Test that we can extract a ! through pattern matching then use it as several different types. // Test that we can extract a ! through pattern matching then use it as several different types.
#![feature(never_type)] #![feature(never_type)]
fn main() { fn main() {
@ -16,6 +15,6 @@ fn main() {
let w: i32 = y; let w: i32 = y;
let e: String = y; let e: String = y;
y y
}, }
} }
} }

View file

@ -1,5 +1,5 @@
error[E0004]: non-exhaustive patterns: type `&!` is non-empty error[E0004]: non-exhaustive patterns: type `&!` is non-empty
--> $DIR/always-inhabited-union-ref.rs:25:11 --> $DIR/always-inhabited-union-ref.rs:24:11
| |
LL | match uninhab_ref() { LL | match uninhab_ref() {
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
@ -14,13 +14,13 @@ LL + }
| |
error[E0004]: non-exhaustive patterns: type `Foo` is non-empty error[E0004]: non-exhaustive patterns: type `Foo` is non-empty
--> $DIR/always-inhabited-union-ref.rs:29:11 --> $DIR/always-inhabited-union-ref.rs:28:11
| |
LL | match uninhab_union() { LL | match uninhab_union() {
| ^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^
| |
note: `Foo` defined here note: `Foo` defined here
--> $DIR/always-inhabited-union-ref.rs:12:11 --> $DIR/always-inhabited-union-ref.rs:11:11
| |
LL | pub union Foo { LL | pub union Foo {
| ^^^ | ^^^

View file

@ -1,5 +1,5 @@
error[E0004]: non-exhaustive patterns: type `&!` is non-empty error[E0004]: non-exhaustive patterns: type `&!` is non-empty
--> $DIR/always-inhabited-union-ref.rs:25:11 --> $DIR/always-inhabited-union-ref.rs:24:11
| |
LL | match uninhab_ref() { LL | match uninhab_ref() {
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
@ -14,13 +14,13 @@ LL + }
| |
error[E0004]: non-exhaustive patterns: type `Foo` is non-empty error[E0004]: non-exhaustive patterns: type `Foo` is non-empty
--> $DIR/always-inhabited-union-ref.rs:29:11 --> $DIR/always-inhabited-union-ref.rs:28:11
| |
LL | match uninhab_union() { LL | match uninhab_union() {
| ^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^
| |
note: `Foo` defined here note: `Foo` defined here
--> $DIR/always-inhabited-union-ref.rs:12:11 --> $DIR/always-inhabited-union-ref.rs:11:11
| |
LL | pub union Foo { LL | pub union Foo {
| ^^^ | ^^^

View file

@ -1,10 +1,9 @@
//@ revisions: min_exhaustive_patterns exhaustive_patterns //@ revisions: normal exhaustive_patterns
// The precise semantics of inhabitedness with respect to unions and references is currently // The precise semantics of inhabitedness with respect to unions and references is currently
// undecided. This test file currently checks a conservative choice. // undecided. This test file currently checks a conservative choice.
#![cfg_attr(exhaustive_patterns, feature(exhaustive_patterns))] #![cfg_attr(exhaustive_patterns, feature(exhaustive_patterns))]
#![cfg_attr(min_exhaustive_patterns, feature(min_exhaustive_patterns))]
#![feature(never_type)] #![feature(never_type)]
#![allow(dead_code)] #![allow(dead_code)]
#![allow(unreachable_code)] #![allow(unreachable_code)]

View file

@ -38,7 +38,7 @@ LL | _ if false => {}
error[E0005]: refutable pattern in local binding error[E0005]: refutable pattern in local binding
--> $DIR/empty-match-check-notes.rs:39:9 --> $DIR/empty-match-check-notes.rs:39:9
| |
LL | let None = x; LL | let None = *x;
| ^^^^ pattern `Some(_)` not covered | ^^^^ pattern `Some(_)` not covered
| |
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
@ -47,8 +47,8 @@ LL | let None = x;
= note: the matched value is of type `Option<SecretlyUninhabitedForeignStruct>` = note: the matched value is of type `Option<SecretlyUninhabitedForeignStruct>`
help: you might want to use `if let` to ignore the variant that isn't matched help: you might want to use `if let` to ignore the variant that isn't matched
| |
LL | if let None = x { todo!() }; LL | if let None = *x { todo!() };
| ++ +++++++++++ | ++ +++++++++++
error[E0004]: non-exhaustive patterns: `0_u8..=u8::MAX` not covered error[E0004]: non-exhaustive patterns: `0_u8..=u8::MAX` not covered
--> $DIR/empty-match-check-notes.rs:49:11 --> $DIR/empty-match-check-notes.rs:49:11

View file

@ -38,16 +38,17 @@ LL | _ if false => {}
error[E0005]: refutable pattern in local binding error[E0005]: refutable pattern in local binding
--> $DIR/empty-match-check-notes.rs:39:9 --> $DIR/empty-match-check-notes.rs:39:9
| |
LL | let None = x; LL | let None = *x;
| ^^^^ pattern `Some(_)` not covered | ^^^^ pattern `Some(_)` not covered
| |
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = 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: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
= note: pattern `Some(_)` is currently uninhabited, but this variant contains private fields which may become inhabited in the future
= note: the matched value is of type `Option<SecretlyUninhabitedForeignStruct>` = note: the matched value is of type `Option<SecretlyUninhabitedForeignStruct>`
help: you might want to use `if let` to ignore the variant that isn't matched help: you might want to use `if let` to ignore the variant that isn't matched
| |
LL | if let None = x { todo!() }; LL | if let None = *x { todo!() };
| ++ +++++++++++ | ++ +++++++++++
error[E0004]: non-exhaustive patterns: `0_u8..=u8::MAX` not covered error[E0004]: non-exhaustive patterns: `0_u8..=u8::MAX` not covered
--> $DIR/empty-match-check-notes.rs:49:11 --> $DIR/empty-match-check-notes.rs:49:11

View file

@ -35,14 +35,14 @@ fn empty_foreign_enum(x: empty::EmptyForeignEnum) {
} }
} }
fn empty_foreign_enum_private(x: Option<empty::SecretlyUninhabitedForeignStruct>) { fn empty_foreign_enum_private(x: &Option<empty::SecretlyUninhabitedForeignStruct>) {
let None = x; let None = *x;
//~^ ERROR refutable pattern in local binding //~^ ERROR refutable pattern in local binding
//~| NOTE `let` bindings require an "irrefutable pattern" //~| NOTE `let` bindings require an "irrefutable pattern"
//~| NOTE for more information, visit //~| NOTE for more information, visit
//~| NOTE the matched value is of type //~| NOTE the matched value is of type
//~| NOTE pattern `Some(_)` not covered //~| NOTE pattern `Some(_)` not covered
//[exhaustive_patterns]~| NOTE currently uninhabited, but this variant contains private fields //~| NOTE currently uninhabited, but this variant contains private fields
} }
fn main() { fn main() {

View file

@ -273,6 +273,7 @@ note: `NonEmptyUnion2` defined here
LL | union NonEmptyUnion2 { LL | union NonEmptyUnion2 {
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
= note: the matched value is of type `NonEmptyUnion2` = note: the matched value is of type `NonEmptyUnion2`
= note: `!` is uninhabited but is not being matched by value, so a wildcard `_` is required
= note: match arms with guards don't count towards exhaustivity = note: match arms with guards don't count towards exhaustivity
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
| |

View file

@ -273,6 +273,7 @@ note: `NonEmptyUnion2` defined here
LL | union NonEmptyUnion2 { LL | union NonEmptyUnion2 {
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
= note: the matched value is of type `NonEmptyUnion2` = note: the matched value is of type `NonEmptyUnion2`
= note: `!` is uninhabited but is not being matched by value, so a wildcard `_` is required
= note: match arms with guards don't count towards exhaustivity = note: match arms with guards don't count towards exhaustivity
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
| |

View file

@ -1,18 +1,18 @@
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:51:9 --> $DIR/empty-types.rs:49:9
| |
LL | _ => {} LL | _ => {}
| ^ | ^
| |
= note: this pattern matches no values because `!` is uninhabited = note: this pattern matches no values because `!` is uninhabited
note: the lint level is defined here note: the lint level is defined here
--> $DIR/empty-types.rs:17:9 --> $DIR/empty-types.rs:15:9
| |
LL | #![deny(unreachable_patterns)] LL | #![deny(unreachable_patterns)]
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:54:9 --> $DIR/empty-types.rs:52:9
| |
LL | _x => {} LL | _x => {}
| ^^ | ^^
@ -20,7 +20,7 @@ LL | _x => {}
= note: this pattern matches no values because `!` is uninhabited = note: this pattern matches no values because `!` is uninhabited
error[E0004]: non-exhaustive patterns: type `&!` is non-empty error[E0004]: non-exhaustive patterns: type `&!` is non-empty
--> $DIR/empty-types.rs:58:11 --> $DIR/empty-types.rs:56:11
| |
LL | match ref_never {} LL | match ref_never {}
| ^^^^^^^^^ | ^^^^^^^^^
@ -35,7 +35,7 @@ LL + }
| |
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:73:9 --> $DIR/empty-types.rs:70:9
| |
LL | (_, _) => {} LL | (_, _) => {}
| ^^^^^^ | ^^^^^^
@ -43,7 +43,7 @@ LL | (_, _) => {}
= note: this pattern matches no values because `(u32, !)` is uninhabited = note: this pattern matches no values because `(u32, !)` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:80:9 --> $DIR/empty-types.rs:76:9
| |
LL | _ => {} LL | _ => {}
| ^ | ^
@ -51,7 +51,7 @@ LL | _ => {}
= note: this pattern matches no values because `(!, !)` is uninhabited = note: this pattern matches no values because `(!, !)` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:83:9 --> $DIR/empty-types.rs:79:9
| |
LL | (_, _) => {} LL | (_, _) => {}
| ^^^^^^ | ^^^^^^
@ -59,7 +59,7 @@ LL | (_, _) => {}
= note: this pattern matches no values because `(!, !)` is uninhabited = note: this pattern matches no values because `(!, !)` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:87:9 --> $DIR/empty-types.rs:83:9
| |
LL | _ => {} LL | _ => {}
| ^ | ^
@ -67,7 +67,7 @@ LL | _ => {}
= note: this pattern matches no values because `!` is uninhabited = note: this pattern matches no values because `!` is uninhabited
error[E0004]: non-exhaustive patterns: `Ok(_)` not covered error[E0004]: non-exhaustive patterns: `Ok(_)` not covered
--> $DIR/empty-types.rs:91:11 --> $DIR/empty-types.rs:87:11
| |
LL | match res_u32_never {} LL | match res_u32_never {}
| ^^^^^^^^^^^^^ pattern `Ok(_)` not covered | ^^^^^^^^^^^^^ pattern `Ok(_)` not covered
@ -86,7 +86,7 @@ LL + }
| |
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:99:9 --> $DIR/empty-types.rs:94:9
| |
LL | Err(_) => {} LL | Err(_) => {}
| ^^^^^^ | ^^^^^^
@ -94,7 +94,7 @@ LL | Err(_) => {}
= note: this pattern matches no values because `!` is uninhabited = note: this pattern matches no values because `!` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:104:9 --> $DIR/empty-types.rs:99:9
| |
LL | Err(_) => {} LL | Err(_) => {}
| ^^^^^^ | ^^^^^^
@ -102,7 +102,7 @@ LL | Err(_) => {}
= note: this pattern matches no values because `!` is uninhabited = note: this pattern matches no values because `!` is uninhabited
error[E0004]: non-exhaustive patterns: `Ok(1_u32..=u32::MAX)` not covered error[E0004]: non-exhaustive patterns: `Ok(1_u32..=u32::MAX)` not covered
--> $DIR/empty-types.rs:101:11 --> $DIR/empty-types.rs:96:11
| |
LL | match res_u32_never { LL | match res_u32_never {
| ^^^^^^^^^^^^^ pattern `Ok(1_u32..=u32::MAX)` not covered | ^^^^^^^^^^^^^ pattern `Ok(1_u32..=u32::MAX)` not covered
@ -120,7 +120,7 @@ LL ~ Ok(1_u32..=u32::MAX) => todo!()
| |
error[E0005]: refutable pattern in local binding error[E0005]: refutable pattern in local binding
--> $DIR/empty-types.rs:108:9 --> $DIR/empty-types.rs:102:9
| |
LL | let Ok(_x) = res_u32_never.as_ref(); LL | let Ok(_x) = res_u32_never.as_ref();
| ^^^^^^ pattern `Err(_)` not covered | ^^^^^^ pattern `Err(_)` not covered
@ -133,6 +133,30 @@ help: you might want to use `let else` to handle the variant that isn't matched
LL | let Ok(_x) = res_u32_never.as_ref() else { todo!() }; LL | let Ok(_x) = res_u32_never.as_ref() else { todo!() };
| ++++++++++++++++ | ++++++++++++++++
error: unreachable pattern
--> $DIR/empty-types.rs:112:9
|
LL | _ => {}
| ^
|
= note: this pattern matches no values because `Result<!, !>` is uninhabited
error: unreachable pattern
--> $DIR/empty-types.rs:115:9
|
LL | Ok(_) => {}
| ^^^^^
|
= note: this pattern matches no values because `Result<!, !>` is uninhabited
error: unreachable pattern
--> $DIR/empty-types.rs:118:9
|
LL | Ok(_) => {}
| ^^^^^
|
= note: this pattern matches no values because `Result<!, !>` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:119:9 --> $DIR/empty-types.rs:119:9
| |
@ -141,48 +165,24 @@ LL | _ => {}
| |
= note: this pattern matches no values because `Result<!, !>` is uninhabited = note: this pattern matches no values because `Result<!, !>` is uninhabited
error: unreachable pattern
--> $DIR/empty-types.rs:122:9
|
LL | Ok(_) => {}
| ^^^^^
|
= note: this pattern matches no values because `Result<!, !>` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:123:9 --> $DIR/empty-types.rs:123:9
| |
LL | Ok(_) => {}
| ^^^^^
|
= note: this pattern matches no values because `Result<!, !>` is uninhabited
error: unreachable pattern
--> $DIR/empty-types.rs:126:9
|
LL | Ok(_) => {}
| ^^^^^
|
= note: this pattern matches no values because `Result<!, !>` is uninhabited
error: unreachable pattern
--> $DIR/empty-types.rs:127:9
|
LL | _ => {}
| ^
|
= note: this pattern matches no values because `Result<!, !>` is uninhabited
error: unreachable pattern
--> $DIR/empty-types.rs:130:9
|
LL | Ok(_) => {}
| ^^^^^
|
= note: this pattern matches no values because `Result<!, !>` is uninhabited
error: unreachable pattern
--> $DIR/empty-types.rs:131:9
|
LL | Err(_) => {} LL | Err(_) => {}
| ^^^^^^ | ^^^^^^
| |
= note: this pattern matches no values because `Result<!, !>` is uninhabited = note: this pattern matches no values because `Result<!, !>` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:140:13 --> $DIR/empty-types.rs:132:13
| |
LL | _ => {} LL | _ => {}
| ^ | ^
@ -190,7 +190,7 @@ LL | _ => {}
= note: this pattern matches no values because `Void` is uninhabited = note: this pattern matches no values because `Void` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:143:13 --> $DIR/empty-types.rs:135:13
| |
LL | _ if false => {} LL | _ if false => {}
| ^ | ^
@ -198,7 +198,7 @@ LL | _ if false => {}
= note: this pattern matches no values because `Void` is uninhabited = note: this pattern matches no values because `Void` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:152:13 --> $DIR/empty-types.rs:143:13
| |
LL | Some(_) => {} LL | Some(_) => {}
| ^^^^^^^ | ^^^^^^^
@ -206,7 +206,7 @@ LL | Some(_) => {}
= note: this pattern matches no values because `Void` is uninhabited = note: this pattern matches no values because `Void` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:156:13 --> $DIR/empty-types.rs:147:13
| |
LL | None => {} LL | None => {}
| ---- matches all the values already | ---- matches all the values already
@ -214,7 +214,7 @@ LL | _ => {}
| ^ unreachable pattern | ^ unreachable pattern
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:208:13 --> $DIR/empty-types.rs:199:13
| |
LL | _ => {} LL | _ => {}
| ^ | ^
@ -222,7 +222,7 @@ LL | _ => {}
= note: this pattern matches no values because `!` is uninhabited = note: this pattern matches no values because `!` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:213:13 --> $DIR/empty-types.rs:204:13
| |
LL | _ => {} LL | _ => {}
| ^ | ^
@ -230,7 +230,7 @@ LL | _ => {}
= note: this pattern matches no values because `!` is uninhabited = note: this pattern matches no values because `!` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:218:13 --> $DIR/empty-types.rs:209:13
| |
LL | _ => {} LL | _ => {}
| ^ | ^
@ -238,7 +238,7 @@ LL | _ => {}
= note: this pattern matches no values because `!` is uninhabited = note: this pattern matches no values because `!` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:223:13 --> $DIR/empty-types.rs:214:13
| |
LL | _ => {} LL | _ => {}
| ^ | ^
@ -246,7 +246,7 @@ LL | _ => {}
= note: this pattern matches no values because `!` is uninhabited = note: this pattern matches no values because `!` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:229:13 --> $DIR/empty-types.rs:220:13
| |
LL | _ => {} LL | _ => {}
| ^ | ^
@ -254,7 +254,7 @@ LL | _ => {}
= note: this pattern matches no values because `!` is uninhabited = note: this pattern matches no values because `!` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:288:9 --> $DIR/empty-types.rs:279:9
| |
LL | _ => {} LL | _ => {}
| ^ | ^
@ -262,7 +262,7 @@ LL | _ => {}
= note: this pattern matches no values because `!` is uninhabited = note: this pattern matches no values because `!` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:291:9 --> $DIR/empty-types.rs:282:9
| |
LL | (_, _) => {} LL | (_, _) => {}
| ^^^^^^ | ^^^^^^
@ -270,7 +270,7 @@ LL | (_, _) => {}
= note: this pattern matches no values because `(!, !)` is uninhabited = note: this pattern matches no values because `(!, !)` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:294:9 --> $DIR/empty-types.rs:285:9
| |
LL | Ok(_) => {} LL | Ok(_) => {}
| ^^^^^ | ^^^^^
@ -278,7 +278,7 @@ LL | Ok(_) => {}
= note: this pattern matches no values because `Result<!, !>` is uninhabited = note: this pattern matches no values because `Result<!, !>` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:295:9 --> $DIR/empty-types.rs:286:9
| |
LL | Err(_) => {} LL | Err(_) => {}
| ^^^^^^ | ^^^^^^
@ -286,7 +286,7 @@ LL | Err(_) => {}
= note: this pattern matches no values because `Result<!, !>` is uninhabited = note: this pattern matches no values because `Result<!, !>` is uninhabited
error[E0004]: non-exhaustive patterns: type `&[!]` is non-empty error[E0004]: non-exhaustive patterns: type `&[!]` is non-empty
--> $DIR/empty-types.rs:327:11 --> $DIR/empty-types.rs:318:11
| |
LL | match slice_never {} LL | match slice_never {}
| ^^^^^^^^^^^ | ^^^^^^^^^^^
@ -300,7 +300,7 @@ LL + }
| |
error[E0004]: non-exhaustive patterns: `&[]` not covered error[E0004]: non-exhaustive patterns: `&[]` not covered
--> $DIR/empty-types.rs:338:11 --> $DIR/empty-types.rs:329:11
| |
LL | match slice_never { LL | match slice_never {
| ^^^^^^^^^^^ pattern `&[]` not covered | ^^^^^^^^^^^ pattern `&[]` not covered
@ -313,7 +313,7 @@ LL + &[] => todo!()
| |
error[E0004]: non-exhaustive patterns: `&[]` not covered error[E0004]: non-exhaustive patterns: `&[]` not covered
--> $DIR/empty-types.rs:352:11 --> $DIR/empty-types.rs:343:11
| |
LL | match slice_never { LL | match slice_never {
| ^^^^^^^^^^^ pattern `&[]` not covered | ^^^^^^^^^^^ pattern `&[]` not covered
@ -327,7 +327,7 @@ LL + &[] => todo!()
| |
error[E0004]: non-exhaustive patterns: type `[!]` is non-empty error[E0004]: non-exhaustive patterns: type `[!]` is non-empty
--> $DIR/empty-types.rs:359:11 --> $DIR/empty-types.rs:350:11
| |
LL | match *slice_never {} LL | match *slice_never {}
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
@ -341,7 +341,7 @@ LL + }
| |
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:369:9 --> $DIR/empty-types.rs:359:9
| |
LL | _ => {} LL | _ => {}
| ^ | ^
@ -349,7 +349,7 @@ LL | _ => {}
= note: this pattern matches no values because `[!; 3]` is uninhabited = note: this pattern matches no values because `[!; 3]` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:372:9 --> $DIR/empty-types.rs:362:9
| |
LL | [_, _, _] => {} LL | [_, _, _] => {}
| ^^^^^^^^^ | ^^^^^^^^^
@ -357,7 +357,7 @@ LL | [_, _, _] => {}
= note: this pattern matches no values because `[!; 3]` is uninhabited = note: this pattern matches no values because `[!; 3]` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:375:9 --> $DIR/empty-types.rs:365:9
| |
LL | [_, ..] => {} LL | [_, ..] => {}
| ^^^^^^^ | ^^^^^^^
@ -365,7 +365,7 @@ LL | [_, ..] => {}
= note: this pattern matches no values because `[!; 3]` is uninhabited = note: this pattern matches no values because `[!; 3]` is uninhabited
error[E0004]: non-exhaustive patterns: type `[!; 0]` is non-empty error[E0004]: non-exhaustive patterns: type `[!; 0]` is non-empty
--> $DIR/empty-types.rs:389:11 --> $DIR/empty-types.rs:379:11
| |
LL | match array_0_never {} LL | match array_0_never {}
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
@ -379,7 +379,7 @@ LL + }
| |
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:396:9 --> $DIR/empty-types.rs:386:9
| |
LL | [] => {} LL | [] => {}
| -- matches all the values already | -- matches all the values already
@ -387,7 +387,7 @@ LL | _ => {}
| ^ unreachable pattern | ^ unreachable pattern
error[E0004]: non-exhaustive patterns: `[]` not covered error[E0004]: non-exhaustive patterns: `[]` not covered
--> $DIR/empty-types.rs:398:11 --> $DIR/empty-types.rs:388:11
| |
LL | match array_0_never { LL | match array_0_never {
| ^^^^^^^^^^^^^ pattern `[]` not covered | ^^^^^^^^^^^^^ pattern `[]` not covered
@ -401,7 +401,7 @@ LL + [] => todo!()
| |
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:417:9 --> $DIR/empty-types.rs:407:9
| |
LL | Some(_) => {} LL | Some(_) => {}
| ^^^^^^^ | ^^^^^^^
@ -409,7 +409,7 @@ LL | Some(_) => {}
= note: this pattern matches no values because `!` is uninhabited = note: this pattern matches no values because `!` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:422:9 --> $DIR/empty-types.rs:412:9
| |
LL | Some(_a) => {} LL | Some(_a) => {}
| ^^^^^^^^ | ^^^^^^^^
@ -417,7 +417,7 @@ LL | Some(_a) => {}
= note: this pattern matches no values because `!` is uninhabited = note: this pattern matches no values because `!` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:427:9 --> $DIR/empty-types.rs:417:9
| |
LL | None => {} LL | None => {}
| ---- matches all the values already | ---- matches all the values already
@ -426,7 +426,7 @@ LL | _ => {}
| ^ unreachable pattern | ^ unreachable pattern
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:432:9 --> $DIR/empty-types.rs:422:9
| |
LL | None => {} LL | None => {}
| ---- matches all the values already | ---- matches all the values already
@ -435,7 +435,7 @@ LL | _a => {}
| ^^ unreachable pattern | ^^ unreachable pattern
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:604:9 --> $DIR/empty-types.rs:594:9
| |
LL | _ => {} LL | _ => {}
| ^ | ^
@ -443,7 +443,7 @@ LL | _ => {}
= note: this pattern matches no values because `!` is uninhabited = note: this pattern matches no values because `!` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:607:9 --> $DIR/empty-types.rs:597:9
| |
LL | _x => {} LL | _x => {}
| ^^ | ^^
@ -451,7 +451,7 @@ LL | _x => {}
= note: this pattern matches no values because `!` is uninhabited = note: this pattern matches no values because `!` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:610:9 --> $DIR/empty-types.rs:600:9
| |
LL | _ if false => {} LL | _ if false => {}
| ^ | ^
@ -459,7 +459,7 @@ LL | _ if false => {}
= note: this pattern matches no values because `!` is uninhabited = note: this pattern matches no values because `!` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:613:9 --> $DIR/empty-types.rs:603:9
| |
LL | _x if false => {} LL | _x if false => {}
| ^^ | ^^

View file

@ -1,5 +1,5 @@
warning: the feature `never_patterns` is incomplete and may not be safe to use and/or cause compiler crashes warning: the feature `never_patterns` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/empty-types.rs:14:33 --> $DIR/empty-types.rs:12:33
| |
LL | #![cfg_attr(never_pats, feature(never_patterns))] LL | #![cfg_attr(never_pats, feature(never_patterns))]
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
@ -8,20 +8,20 @@ LL | #![cfg_attr(never_pats, feature(never_patterns))]
= note: `#[warn(incomplete_features)]` on by default = note: `#[warn(incomplete_features)]` on by default
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:51:9 --> $DIR/empty-types.rs:49:9
| |
LL | _ => {} LL | _ => {}
| ^ | ^
| |
= note: this pattern matches no values because `!` is uninhabited = note: this pattern matches no values because `!` is uninhabited
note: the lint level is defined here note: the lint level is defined here
--> $DIR/empty-types.rs:17:9 --> $DIR/empty-types.rs:15:9
| |
LL | #![deny(unreachable_patterns)] LL | #![deny(unreachable_patterns)]
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:54:9 --> $DIR/empty-types.rs:52:9
| |
LL | _x => {} LL | _x => {}
| ^^ | ^^
@ -29,7 +29,7 @@ LL | _x => {}
= note: this pattern matches no values because `!` is uninhabited = note: this pattern matches no values because `!` is uninhabited
error[E0004]: non-exhaustive patterns: type `&!` is non-empty error[E0004]: non-exhaustive patterns: type `&!` is non-empty
--> $DIR/empty-types.rs:58:11 --> $DIR/empty-types.rs:56:11
| |
LL | match ref_never {} LL | match ref_never {}
| ^^^^^^^^^ | ^^^^^^^^^
@ -43,69 +43,43 @@ LL + _ => todo!(),
LL + } LL + }
| |
error[E0004]: non-exhaustive patterns: type `(u32, !)` is non-empty error: unreachable pattern
--> $DIR/empty-types.rs:70:11 --> $DIR/empty-types.rs:70:9
| |
LL | match tuple_half_never {} LL | (_, _) => {}
| ^^^^^^^^^^^^^^^^ | ^^^^^^
|
= note: the matched value is of type `(u32, !)`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown
|
LL ~ match tuple_half_never {
LL + _ => todo!(),
LL + }
|
error[E0004]: non-exhaustive patterns: type `(!, !)` is non-empty
--> $DIR/empty-types.rs:77:11
|
LL | match tuple_never {}
| ^^^^^^^^^^^
|
= note: the matched value is of type `(!, !)`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown
|
LL ~ match tuple_never {
LL + _ => todo!(),
LL + }
| |
= note: this pattern matches no values because `(u32, !)` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:87:9 --> $DIR/empty-types.rs:76:9
|
LL | _ => {}
| ^
|
= note: this pattern matches no values because `(!, !)` is uninhabited
error: unreachable pattern
--> $DIR/empty-types.rs:79:9
|
LL | (_, _) => {}
| ^^^^^^
|
= note: this pattern matches no values because `(!, !)` is uninhabited
error: unreachable pattern
--> $DIR/empty-types.rs:83:9
| |
LL | _ => {} LL | _ => {}
| ^ | ^
| |
= note: this pattern matches no values because `!` is uninhabited = note: this pattern matches no values because `!` is uninhabited
error[E0004]: non-exhaustive patterns: `Ok(_)` and `Err(!)` not covered error[E0004]: non-exhaustive patterns: `Ok(_)` not covered
--> $DIR/empty-types.rs:91:11 --> $DIR/empty-types.rs:87:11
| |
LL | match res_u32_never {} LL | match res_u32_never {}
| ^^^^^^^^^^^^^ patterns `Ok(_)` and `Err(!)` not covered | ^^^^^^^^^^^^^ pattern `Ok(_)` not covered
|
note: `Result<u32, !>` defined here
--> $SRC_DIR/core/src/result.rs:LL:COL
::: $SRC_DIR/core/src/result.rs:LL:COL
|
= note: not covered
::: $SRC_DIR/core/src/result.rs:LL:COL
|
= note: not covered
= note: the matched value is of type `Result<u32, !>`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
LL ~ match res_u32_never {
LL + Ok(_) | Err(!) => todo!(),
LL + }
|
error[E0004]: non-exhaustive patterns: `Err(!)` not covered
--> $DIR/empty-types.rs:93:11
|
LL | match res_u32_never {
| ^^^^^^^^^^^^^ pattern `Err(!)` not covered
| |
note: `Result<u32, !>` defined here note: `Result<u32, !>` defined here
--> $SRC_DIR/core/src/result.rs:LL:COL --> $SRC_DIR/core/src/result.rs:LL:COL
@ -115,12 +89,29 @@ note: `Result<u32, !>` defined here
= note: the matched value is of type `Result<u32, !>` = note: the matched value is of type `Result<u32, !>`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown 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 ~ Ok(_) => {}, LL ~ match res_u32_never {
LL + Err(!) LL + Ok(_) => todo!(),
LL + }
| |
error: unreachable pattern
--> $DIR/empty-types.rs:94:9
|
LL | Err(_) => {}
| ^^^^^^
|
= note: this pattern matches no values because `!` is uninhabited
error: unreachable pattern
--> $DIR/empty-types.rs:99:9
|
LL | Err(_) => {}
| ^^^^^^
|
= note: this pattern matches no values because `!` is uninhabited
error[E0004]: non-exhaustive patterns: `Ok(1_u32..=u32::MAX)` not covered error[E0004]: non-exhaustive patterns: `Ok(1_u32..=u32::MAX)` not covered
--> $DIR/empty-types.rs:101:11 --> $DIR/empty-types.rs:96:11
| |
LL | match res_u32_never { LL | match res_u32_never {
| ^^^^^^^^^^^^^ pattern `Ok(1_u32..=u32::MAX)` not covered | ^^^^^^^^^^^^^ pattern `Ok(1_u32..=u32::MAX)` not covered
@ -138,21 +129,7 @@ LL ~ Ok(1_u32..=u32::MAX) => todo!()
| |
error[E0005]: refutable pattern in local binding error[E0005]: refutable pattern in local binding
--> $DIR/empty-types.rs:106:9 --> $DIR/empty-types.rs:102:9
|
LL | let Ok(_x) = res_u32_never;
| ^^^^^^ pattern `Err(!)` 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: the matched value is of type `Result<u32, !>`
help: you might want to use `let else` to handle the variant that isn't matched
|
LL | let Ok(_x) = res_u32_never else { todo!() };
| ++++++++++++++++
error[E0005]: refutable pattern in local binding
--> $DIR/empty-types.rs:108:9
| |
LL | let Ok(_x) = res_u32_never.as_ref(); LL | let Ok(_x) = res_u32_never.as_ref();
| ^^^^^^ pattern `Err(_)` not covered | ^^^^^^ pattern `Err(_)` not covered
@ -166,7 +143,7 @@ LL | let Ok(_x) = res_u32_never.as_ref() else { todo!() };
| ++++++++++++++++ | ++++++++++++++++
error[E0005]: refutable pattern in local binding error[E0005]: refutable pattern in local binding
--> $DIR/empty-types.rs:112:9 --> $DIR/empty-types.rs:106:9
| |
LL | let Ok(_x) = &res_u32_never; LL | let Ok(_x) = &res_u32_never;
| ^^^^^^ pattern `&Err(!)` not covered | ^^^^^^ pattern `&Err(!)` not covered
@ -179,47 +156,56 @@ help: you might want to use `let else` to handle the variant that isn't matched
LL | let Ok(_x) = &res_u32_never else { todo!() }; LL | let Ok(_x) = &res_u32_never else { todo!() };
| ++++++++++++++++ | ++++++++++++++++
error[E0004]: non-exhaustive patterns: `Ok(!)` and `Err(!)` not covered error: unreachable pattern
--> $DIR/empty-types.rs:116:11 --> $DIR/empty-types.rs:112:9
| |
LL | match result_never {} LL | _ => {}
| ^^^^^^^^^^^^ patterns `Ok(!)` and `Err(!)` not covered | ^
| |
note: `Result<!, !>` defined here = note: this pattern matches no values because `Result<!, !>` is uninhabited
--> $SRC_DIR/core/src/result.rs:LL:COL
::: $SRC_DIR/core/src/result.rs:LL:COL
|
= note: not covered
::: $SRC_DIR/core/src/result.rs:LL:COL
|
= note: not covered
= note: the matched value is of type `Result<!, !>`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
LL ~ match result_never {
LL + Ok(!) | Err(!),
LL + }
|
error[E0004]: non-exhaustive patterns: `Err(!)` not covered
--> $DIR/empty-types.rs:121:11
|
LL | match result_never {
| ^^^^^^^^^^^^ pattern `Err(!)` not covered
|
note: `Result<!, !>` defined here
--> $SRC_DIR/core/src/result.rs:LL:COL
::: $SRC_DIR/core/src/result.rs:LL:COL
|
= note: not covered
= note: the matched value is of type `Result<!, !>`
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 | Ok(_) => {}, Err(!)
| ++++++++
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:140:13 --> $DIR/empty-types.rs:115:9
|
LL | Ok(_) => {}
| ^^^^^
|
= note: this pattern matches no values because `Result<!, !>` is uninhabited
error: unreachable pattern
--> $DIR/empty-types.rs:118:9
|
LL | Ok(_) => {}
| ^^^^^
|
= note: this pattern matches no values because `Result<!, !>` is uninhabited
error: unreachable pattern
--> $DIR/empty-types.rs:119:9
|
LL | _ => {}
| ^
|
= note: this pattern matches no values because `Result<!, !>` is uninhabited
error: unreachable pattern
--> $DIR/empty-types.rs:122:9
|
LL | Ok(_) => {}
| ^^^^^
|
= note: this pattern matches no values because `Result<!, !>` is uninhabited
error: unreachable pattern
--> $DIR/empty-types.rs:123:9
|
LL | Err(_) => {}
| ^^^^^^
|
= note: this pattern matches no values because `Result<!, !>` is uninhabited
error: unreachable pattern
--> $DIR/empty-types.rs:132:13
| |
LL | _ => {} LL | _ => {}
| ^ | ^
@ -227,33 +213,31 @@ LL | _ => {}
= note: this pattern matches no values because `Void` is uninhabited = note: this pattern matches no values because `Void` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:143:13 --> $DIR/empty-types.rs:135:13
| |
LL | _ if false => {} LL | _ if false => {}
| ^ | ^
| |
= note: this pattern matches no values because `Void` is uninhabited = note: this pattern matches no values because `Void` is uninhabited
error[E0004]: non-exhaustive patterns: `Some(!)` not covered error: unreachable pattern
--> $DIR/empty-types.rs:146:15 --> $DIR/empty-types.rs:143:13
| |
LL | match opt_void { LL | Some(_) => {}
| ^^^^^^^^ pattern `Some(!)` not covered | ^^^^^^^
| |
note: `Option<Void>` defined here = note: this pattern matches no values because `Void` is uninhabited
--> $SRC_DIR/core/src/option.rs:LL:COL
::: $SRC_DIR/core/src/option.rs:LL:COL error: unreachable pattern
| --> $DIR/empty-types.rs:147:13
= note: not covered
= note: the matched value is of type `Option<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
|
LL ~ None => {},
LL + Some(!)
| |
LL | None => {}
| ---- matches all the values already
LL | _ => {}
| ^ unreachable pattern
error[E0004]: non-exhaustive patterns: `Some(!)` not covered error[E0004]: non-exhaustive patterns: `Some(!)` not covered
--> $DIR/empty-types.rs:165:15 --> $DIR/empty-types.rs:156:15
| |
LL | match *ref_opt_void { LL | match *ref_opt_void {
| ^^^^^^^^^^^^^ pattern `Some(!)` not covered | ^^^^^^^^^^^^^ pattern `Some(!)` not covered
@ -264,6 +248,7 @@ note: `Option<Void>` defined here
| |
= note: not covered = note: not covered
= note: the matched value is of type `Option<Void>` = note: the matched value is of type `Option<Void>`
= note: `Void` is uninhabited but is not being matched by value, so a wildcard `_` is required
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown 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 ~ None => {}, LL ~ None => {},
@ -271,7 +256,7 @@ LL + Some(!)
| |
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:208:13 --> $DIR/empty-types.rs:199:13
| |
LL | _ => {} LL | _ => {}
| ^ | ^
@ -279,7 +264,7 @@ LL | _ => {}
= note: this pattern matches no values because `!` is uninhabited = note: this pattern matches no values because `!` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:213:13 --> $DIR/empty-types.rs:204:13
| |
LL | _ => {} LL | _ => {}
| ^ | ^
@ -287,7 +272,7 @@ LL | _ => {}
= note: this pattern matches no values because `!` is uninhabited = note: this pattern matches no values because `!` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:218:13 --> $DIR/empty-types.rs:209:13
| |
LL | _ => {} LL | _ => {}
| ^ | ^
@ -295,7 +280,7 @@ LL | _ => {}
= note: this pattern matches no values because `!` is uninhabited = note: this pattern matches no values because `!` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:223:13 --> $DIR/empty-types.rs:214:13
| |
LL | _ => {} LL | _ => {}
| ^ | ^
@ -303,7 +288,7 @@ LL | _ => {}
= note: this pattern matches no values because `!` is uninhabited = note: this pattern matches no values because `!` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:229:13 --> $DIR/empty-types.rs:220:13
| |
LL | _ => {} LL | _ => {}
| ^ | ^
@ -311,15 +296,39 @@ LL | _ => {}
= note: this pattern matches no values because `!` is uninhabited = note: this pattern matches no values because `!` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:288:9 --> $DIR/empty-types.rs:279:9
| |
LL | _ => {} LL | _ => {}
| ^ | ^
| |
= note: this pattern matches no values because `!` is uninhabited = note: this pattern matches no values because `!` is uninhabited
error: unreachable pattern
--> $DIR/empty-types.rs:282:9
|
LL | (_, _) => {}
| ^^^^^^
|
= note: this pattern matches no values because `(!, !)` is uninhabited
error: unreachable pattern
--> $DIR/empty-types.rs:285:9
|
LL | Ok(_) => {}
| ^^^^^
|
= note: this pattern matches no values because `Result<!, !>` is uninhabited
error: unreachable pattern
--> $DIR/empty-types.rs:286:9
|
LL | Err(_) => {}
| ^^^^^^
|
= note: this pattern matches no values because `Result<!, !>` is uninhabited
error[E0004]: non-exhaustive patterns: type `(u32, !)` is non-empty error[E0004]: non-exhaustive patterns: type `(u32, !)` is non-empty
--> $DIR/empty-types.rs:316:11 --> $DIR/empty-types.rs:307:11
| |
LL | match *x {} LL | match *x {}
| ^^ | ^^
@ -333,7 +342,7 @@ LL ~ }
| |
error[E0004]: non-exhaustive patterns: type `(!, !)` is non-empty error[E0004]: non-exhaustive patterns: type `(!, !)` is non-empty
--> $DIR/empty-types.rs:318:11 --> $DIR/empty-types.rs:309:11
| |
LL | match *x {} LL | match *x {}
| ^^ | ^^
@ -347,7 +356,7 @@ LL ~ }
| |
error[E0004]: non-exhaustive patterns: `Ok(!)` and `Err(!)` not covered error[E0004]: non-exhaustive patterns: `Ok(!)` and `Err(!)` not covered
--> $DIR/empty-types.rs:320:11 --> $DIR/empty-types.rs:311:11
| |
LL | match *x {} LL | match *x {}
| ^^ patterns `Ok(!)` and `Err(!)` not covered | ^^ patterns `Ok(!)` and `Err(!)` not covered
@ -369,7 +378,7 @@ LL ~ }
| |
error[E0004]: non-exhaustive patterns: type `[!; 3]` is non-empty error[E0004]: non-exhaustive patterns: type `[!; 3]` is non-empty
--> $DIR/empty-types.rs:322:11 --> $DIR/empty-types.rs:313:11
| |
LL | match *x {} LL | match *x {}
| ^^ | ^^
@ -383,7 +392,7 @@ LL ~ }
| |
error[E0004]: non-exhaustive patterns: type `&[!]` is non-empty error[E0004]: non-exhaustive patterns: type `&[!]` is non-empty
--> $DIR/empty-types.rs:327:11 --> $DIR/empty-types.rs:318:11
| |
LL | match slice_never {} LL | match slice_never {}
| ^^^^^^^^^^^ | ^^^^^^^^^^^
@ -397,12 +406,13 @@ LL + }
| |
error[E0004]: non-exhaustive patterns: `&[!, ..]` not covered error[E0004]: non-exhaustive patterns: `&[!, ..]` not covered
--> $DIR/empty-types.rs:329:11 --> $DIR/empty-types.rs:320:11
| |
LL | match slice_never { LL | match slice_never {
| ^^^^^^^^^^^ pattern `&[!, ..]` not covered | ^^^^^^^^^^^ pattern `&[!, ..]` not covered
| |
= note: the matched value is of type `&[!]` = note: the matched value is of type `&[!]`
= note: `!` is uninhabited but is not being matched by value, so a wildcard `_` is required
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown 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 ~ [] => {}, LL ~ [] => {},
@ -410,7 +420,7 @@ LL + &[!, ..]
| |
error[E0004]: non-exhaustive patterns: `&[]`, `&[!]` and `&[!, !]` not covered error[E0004]: non-exhaustive patterns: `&[]`, `&[!]` and `&[!, !]` not covered
--> $DIR/empty-types.rs:338:11 --> $DIR/empty-types.rs:329:11
| |
LL | match slice_never { LL | match slice_never {
| ^^^^^^^^^^^ patterns `&[]`, `&[!]` and `&[!, !]` not covered | ^^^^^^^^^^^ patterns `&[]`, `&[!]` and `&[!, !]` not covered
@ -423,7 +433,7 @@ LL + &[] | &[!] | &[!, !] => todo!()
| |
error[E0004]: non-exhaustive patterns: `&[]` and `&[!, ..]` not covered error[E0004]: non-exhaustive patterns: `&[]` and `&[!, ..]` not covered
--> $DIR/empty-types.rs:352:11 --> $DIR/empty-types.rs:343:11
| |
LL | match slice_never { LL | match slice_never {
| ^^^^^^^^^^^ patterns `&[]` and `&[!, ..]` not covered | ^^^^^^^^^^^ patterns `&[]` and `&[!, ..]` not covered
@ -437,7 +447,7 @@ LL + &[] | &[!, ..] => todo!()
| |
error[E0004]: non-exhaustive patterns: type `[!]` is non-empty error[E0004]: non-exhaustive patterns: type `[!]` is non-empty
--> $DIR/empty-types.rs:359:11 --> $DIR/empty-types.rs:350:11
| |
LL | match *slice_never {} LL | match *slice_never {}
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
@ -450,22 +460,32 @@ LL + _ => todo!(),
LL + } LL + }
| |
error[E0004]: non-exhaustive patterns: type `[!; 3]` is non-empty error: unreachable pattern
--> $DIR/empty-types.rs:366:11 --> $DIR/empty-types.rs:359:9
| |
LL | match array_3_never {} LL | _ => {}
| ^^^^^^^^^^^^^ | ^
| |
= note: the matched value is of type `[!; 3]` = note: this pattern matches no values because `[!; 3]` is uninhabited
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown
error: unreachable pattern
--> $DIR/empty-types.rs:362:9
| |
LL ~ match array_3_never { LL | [_, _, _] => {}
LL + _ => todo!(), | ^^^^^^^^^
LL + }
| |
= note: this pattern matches no values because `[!; 3]` is uninhabited
error: unreachable pattern
--> $DIR/empty-types.rs:365:9
|
LL | [_, ..] => {}
| ^^^^^^^
|
= note: this pattern matches no values because `[!; 3]` is uninhabited
error[E0004]: non-exhaustive patterns: type `[!; 0]` is non-empty error[E0004]: non-exhaustive patterns: type `[!; 0]` is non-empty
--> $DIR/empty-types.rs:389:11 --> $DIR/empty-types.rs:379:11
| |
LL | match array_0_never {} LL | match array_0_never {}
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
@ -479,7 +499,7 @@ LL + }
| |
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:396:9 --> $DIR/empty-types.rs:386:9
| |
LL | [] => {} LL | [] => {}
| -- matches all the values already | -- matches all the values already
@ -487,7 +507,7 @@ LL | _ => {}
| ^ unreachable pattern | ^ unreachable pattern
error[E0004]: non-exhaustive patterns: `[]` not covered error[E0004]: non-exhaustive patterns: `[]` not covered
--> $DIR/empty-types.rs:398:11 --> $DIR/empty-types.rs:388:11
| |
LL | match array_0_never { LL | match array_0_never {
| ^^^^^^^^^^^^^ pattern `[]` not covered | ^^^^^^^^^^^^^ pattern `[]` not covered
@ -500,8 +520,42 @@ LL ~ [..] if false => {},
LL + [] => todo!() LL + [] => todo!()
| |
error: unreachable pattern
--> $DIR/empty-types.rs:407:9
|
LL | Some(_) => {}
| ^^^^^^^
|
= note: this pattern matches no values because `!` is uninhabited
error: unreachable pattern
--> $DIR/empty-types.rs:412:9
|
LL | Some(_a) => {}
| ^^^^^^^^
|
= note: this pattern matches no values because `!` is uninhabited
error: unreachable pattern
--> $DIR/empty-types.rs:417:9
|
LL | None => {}
| ---- matches all the values already
LL | // !useful, !reachable
LL | _ => {}
| ^ unreachable pattern
error: unreachable pattern
--> $DIR/empty-types.rs:422:9
|
LL | None => {}
| ---- matches all the values already
LL | // !useful, !reachable
LL | _a => {}
| ^^ unreachable pattern
error[E0004]: non-exhaustive patterns: `&Some(!)` not covered error[E0004]: non-exhaustive patterns: `&Some(!)` not covered
--> $DIR/empty-types.rs:452:11 --> $DIR/empty-types.rs:442:11
| |
LL | match ref_opt_never { LL | match ref_opt_never {
| ^^^^^^^^^^^^^ pattern `&Some(!)` not covered | ^^^^^^^^^^^^^ pattern `&Some(!)` not covered
@ -512,6 +566,7 @@ note: `Option<!>` defined here
| |
= note: not covered = note: not covered
= note: the matched value is of type `&Option<!>` = note: the matched value is of type `&Option<!>`
= note: `!` is uninhabited but is not being matched by value, so a wildcard `_` is required
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown 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 ~ &None => {}, LL ~ &None => {},
@ -519,7 +574,7 @@ LL + &Some(!)
| |
error[E0004]: non-exhaustive patterns: `Some(!)` not covered error[E0004]: non-exhaustive patterns: `Some(!)` not covered
--> $DIR/empty-types.rs:493:11 --> $DIR/empty-types.rs:483:11
| |
LL | match *ref_opt_never { LL | match *ref_opt_never {
| ^^^^^^^^^^^^^^ pattern `Some(!)` not covered | ^^^^^^^^^^^^^^ pattern `Some(!)` not covered
@ -530,6 +585,7 @@ note: `Option<!>` defined here
| |
= note: not covered = note: not covered
= note: the matched value is of type `Option<!>` = note: the matched value is of type `Option<!>`
= note: `!` is uninhabited but is not being matched by value, so a wildcard `_` is required
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown 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 ~ None => {}, LL ~ None => {},
@ -537,7 +593,7 @@ LL + Some(!)
| |
error[E0004]: non-exhaustive patterns: `Err(!)` not covered error[E0004]: non-exhaustive patterns: `Err(!)` not covered
--> $DIR/empty-types.rs:541:11 --> $DIR/empty-types.rs:531:11
| |
LL | match *ref_res_never { LL | match *ref_res_never {
| ^^^^^^^^^^^^^^ pattern `Err(!)` not covered | ^^^^^^^^^^^^^^ pattern `Err(!)` not covered
@ -548,6 +604,7 @@ note: `Result<!, !>` defined here
| |
= note: not covered = note: not covered
= note: the matched value is of type `Result<!, !>` = note: the matched value is of type `Result<!, !>`
= note: `!` is uninhabited but is not being matched by value, so a wildcard `_` is required
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown 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 ~ Ok(_) => {}, LL ~ Ok(_) => {},
@ -555,7 +612,7 @@ LL + Err(!)
| |
error[E0004]: non-exhaustive patterns: `Err(!)` not covered error[E0004]: non-exhaustive patterns: `Err(!)` not covered
--> $DIR/empty-types.rs:552:11 --> $DIR/empty-types.rs:542:11
| |
LL | match *ref_res_never { LL | match *ref_res_never {
| ^^^^^^^^^^^^^^ pattern `Err(!)` not covered | ^^^^^^^^^^^^^^ pattern `Err(!)` not covered
@ -566,6 +623,7 @@ note: `Result<!, !>` defined here
| |
= note: not covered = note: not covered
= note: the matched value is of type `Result<!, !>` = note: the matched value is of type `Result<!, !>`
= note: `!` is uninhabited but is not being matched by value, so a wildcard `_` is required
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown 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 ~ Ok(_a) => {}, LL ~ Ok(_a) => {},
@ -573,7 +631,7 @@ LL + Err(!)
| |
error[E0004]: non-exhaustive patterns: type `(u32, !)` is non-empty error[E0004]: non-exhaustive patterns: type `(u32, !)` is non-empty
--> $DIR/empty-types.rs:571:11 --> $DIR/empty-types.rs:561:11
| |
LL | match *ref_tuple_half_never {} LL | match *ref_tuple_half_never {}
| ^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^
@ -587,7 +645,7 @@ LL + }
| |
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:604:9 --> $DIR/empty-types.rs:594:9
| |
LL | _ => {} LL | _ => {}
| ^ | ^
@ -595,7 +653,7 @@ LL | _ => {}
= note: this pattern matches no values because `!` is uninhabited = note: this pattern matches no values because `!` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:607:9 --> $DIR/empty-types.rs:597:9
| |
LL | _x => {} LL | _x => {}
| ^^ | ^^
@ -603,7 +661,7 @@ LL | _x => {}
= note: this pattern matches no values because `!` is uninhabited = note: this pattern matches no values because `!` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:610:9 --> $DIR/empty-types.rs:600:9
| |
LL | _ if false => {} LL | _ if false => {}
| ^ | ^
@ -611,7 +669,7 @@ LL | _ if false => {}
= note: this pattern matches no values because `!` is uninhabited = note: this pattern matches no values because `!` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:613:9 --> $DIR/empty-types.rs:603:9
| |
LL | _x if false => {} LL | _x if false => {}
| ^^ | ^^
@ -619,12 +677,13 @@ LL | _x if false => {}
= note: this pattern matches no values because `!` is uninhabited = note: this pattern matches no values because `!` is uninhabited
error[E0004]: non-exhaustive patterns: `&!` not covered error[E0004]: non-exhaustive patterns: `&!` not covered
--> $DIR/empty-types.rs:638:11 --> $DIR/empty-types.rs:628:11
| |
LL | match ref_never { LL | match ref_never {
| ^^^^^^^^^ pattern `&!` not covered | ^^^^^^^^^ pattern `&!` not covered
| |
= note: the matched value is of type `&!` = note: the matched value is of type `&!`
= note: `!` is uninhabited but is not being matched by value, so a wildcard `_` is required
= note: references are always considered inhabited = note: references are always considered inhabited
= note: match arms with guards don't count towards exhaustivity = note: match arms with guards don't count towards exhaustivity
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
@ -634,7 +693,7 @@ LL + &!
| |
error[E0004]: non-exhaustive patterns: `Ok(!)` not covered error[E0004]: non-exhaustive patterns: `Ok(!)` not covered
--> $DIR/empty-types.rs:654:11 --> $DIR/empty-types.rs:644:11
| |
LL | match *ref_result_never { LL | match *ref_result_never {
| ^^^^^^^^^^^^^^^^^ pattern `Ok(!)` not covered | ^^^^^^^^^^^^^^^^^ pattern `Ok(!)` not covered
@ -645,6 +704,7 @@ note: `Result<!, !>` defined here
| |
= note: not covered = note: not covered
= note: the matched value is of type `Result<!, !>` = note: the matched value is of type `Result<!, !>`
= note: `!` is uninhabited but is not being matched by value, so a wildcard `_` is required
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown 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 ~ Err(_) => {}, LL ~ Err(_) => {},
@ -652,7 +712,7 @@ LL + Ok(!)
| |
error[E0004]: non-exhaustive patterns: `Some(!)` not covered error[E0004]: non-exhaustive patterns: `Some(!)` not covered
--> $DIR/empty-types.rs:674:11 --> $DIR/empty-types.rs:664:11
| |
LL | match *x { LL | match *x {
| ^^ pattern `Some(!)` not covered | ^^ pattern `Some(!)` not covered
@ -663,13 +723,14 @@ note: `Option<Result<!, !>>` defined here
| |
= note: not covered = note: not covered
= note: the matched value is of type `Option<Result<!, !>>` = note: the matched value is of type `Option<Result<!, !>>`
= note: `Result<!, !>` is uninhabited but is not being matched by value, so a wildcard `_` is required
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown 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 ~ None => {}, LL ~ None => {},
LL + Some(!) LL + Some(!)
| |
error: aborting due to 49 previous errors; 1 warning emitted error: aborting due to 64 previous errors; 1 warning emitted
Some errors have detailed explanations: E0004, E0005. Some errors have detailed explanations: E0004, E0005.
For more information about an error, try `rustc --explain E0004`. For more information about an error, try `rustc --explain E0004`.

View file

@ -1,18 +1,18 @@
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:51:9 --> $DIR/empty-types.rs:49:9
| |
LL | _ => {} LL | _ => {}
| ^ | ^
| |
= note: this pattern matches no values because `!` is uninhabited = note: this pattern matches no values because `!` is uninhabited
note: the lint level is defined here note: the lint level is defined here
--> $DIR/empty-types.rs:17:9 --> $DIR/empty-types.rs:15:9
| |
LL | #![deny(unreachable_patterns)] LL | #![deny(unreachable_patterns)]
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:54:9 --> $DIR/empty-types.rs:52:9
| |
LL | _x => {} LL | _x => {}
| ^^ | ^^
@ -20,7 +20,7 @@ LL | _x => {}
= note: this pattern matches no values because `!` is uninhabited = note: this pattern matches no values because `!` is uninhabited
error[E0004]: non-exhaustive patterns: type `&!` is non-empty error[E0004]: non-exhaustive patterns: type `&!` is non-empty
--> $DIR/empty-types.rs:58:11 --> $DIR/empty-types.rs:56:11
| |
LL | match ref_never {} LL | match ref_never {}
| ^^^^^^^^^ | ^^^^^^^^^
@ -34,69 +34,43 @@ LL + _ => todo!(),
LL + } LL + }
| |
error[E0004]: non-exhaustive patterns: type `(u32, !)` is non-empty error: unreachable pattern
--> $DIR/empty-types.rs:70:11 --> $DIR/empty-types.rs:70:9
| |
LL | match tuple_half_never {} LL | (_, _) => {}
| ^^^^^^^^^^^^^^^^ | ^^^^^^
|
= note: the matched value is of type `(u32, !)`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown
|
LL ~ match tuple_half_never {
LL + _ => todo!(),
LL + }
|
error[E0004]: non-exhaustive patterns: type `(!, !)` is non-empty
--> $DIR/empty-types.rs:77:11
|
LL | match tuple_never {}
| ^^^^^^^^^^^
|
= note: the matched value is of type `(!, !)`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown
|
LL ~ match tuple_never {
LL + _ => todo!(),
LL + }
| |
= note: this pattern matches no values because `(u32, !)` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:87:9 --> $DIR/empty-types.rs:76:9
|
LL | _ => {}
| ^
|
= note: this pattern matches no values because `(!, !)` is uninhabited
error: unreachable pattern
--> $DIR/empty-types.rs:79:9
|
LL | (_, _) => {}
| ^^^^^^
|
= note: this pattern matches no values because `(!, !)` is uninhabited
error: unreachable pattern
--> $DIR/empty-types.rs:83:9
| |
LL | _ => {} LL | _ => {}
| ^ | ^
| |
= note: this pattern matches no values because `!` is uninhabited = note: this pattern matches no values because `!` is uninhabited
error[E0004]: non-exhaustive patterns: `Ok(_)` and `Err(_)` not covered error[E0004]: non-exhaustive patterns: `Ok(_)` not covered
--> $DIR/empty-types.rs:91:11 --> $DIR/empty-types.rs:87:11
| |
LL | match res_u32_never {} LL | match res_u32_never {}
| ^^^^^^^^^^^^^ patterns `Ok(_)` and `Err(_)` not covered | ^^^^^^^^^^^^^ pattern `Ok(_)` not covered
|
note: `Result<u32, !>` defined here
--> $SRC_DIR/core/src/result.rs:LL:COL
::: $SRC_DIR/core/src/result.rs:LL:COL
|
= note: not covered
::: $SRC_DIR/core/src/result.rs:LL:COL
|
= note: not covered
= note: the matched value is of type `Result<u32, !>`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
LL ~ match res_u32_never {
LL + Ok(_) | Err(_) => todo!(),
LL + }
|
error[E0004]: non-exhaustive patterns: `Err(_)` not covered
--> $DIR/empty-types.rs:93:11
|
LL | match res_u32_never {
| ^^^^^^^^^^^^^ pattern `Err(_)` not covered
| |
note: `Result<u32, !>` defined here note: `Result<u32, !>` defined here
--> $SRC_DIR/core/src/result.rs:LL:COL --> $SRC_DIR/core/src/result.rs:LL:COL
@ -106,12 +80,29 @@ note: `Result<u32, !>` defined here
= note: the matched value is of type `Result<u32, !>` = note: the matched value is of type `Result<u32, !>`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown 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 ~ Ok(_) => {}, LL ~ match res_u32_never {
LL + Err(_) => todo!() LL + Ok(_) => todo!(),
LL + }
| |
error: unreachable pattern
--> $DIR/empty-types.rs:94:9
|
LL | Err(_) => {}
| ^^^^^^
|
= note: this pattern matches no values because `!` is uninhabited
error: unreachable pattern
--> $DIR/empty-types.rs:99:9
|
LL | Err(_) => {}
| ^^^^^^
|
= note: this pattern matches no values because `!` is uninhabited
error[E0004]: non-exhaustive patterns: `Ok(1_u32..=u32::MAX)` not covered error[E0004]: non-exhaustive patterns: `Ok(1_u32..=u32::MAX)` not covered
--> $DIR/empty-types.rs:101:11 --> $DIR/empty-types.rs:96:11
| |
LL | match res_u32_never { LL | match res_u32_never {
| ^^^^^^^^^^^^^ pattern `Ok(1_u32..=u32::MAX)` not covered | ^^^^^^^^^^^^^ pattern `Ok(1_u32..=u32::MAX)` not covered
@ -129,21 +120,7 @@ LL ~ Ok(1_u32..=u32::MAX) => todo!()
| |
error[E0005]: refutable pattern in local binding error[E0005]: refutable pattern in local binding
--> $DIR/empty-types.rs:106:9 --> $DIR/empty-types.rs:102:9
|
LL | let Ok(_x) = res_u32_never;
| ^^^^^^ pattern `Err(_)` 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: the matched value is of type `Result<u32, !>`
help: you might want to use `let else` to handle the variant that isn't matched
|
LL | let Ok(_x) = res_u32_never else { todo!() };
| ++++++++++++++++
error[E0005]: refutable pattern in local binding
--> $DIR/empty-types.rs:108:9
| |
LL | let Ok(_x) = res_u32_never.as_ref(); LL | let Ok(_x) = res_u32_never.as_ref();
| ^^^^^^ pattern `Err(_)` not covered | ^^^^^^ pattern `Err(_)` not covered
@ -157,7 +134,7 @@ LL | let Ok(_x) = res_u32_never.as_ref() else { todo!() };
| ++++++++++++++++ | ++++++++++++++++
error[E0005]: refutable pattern in local binding error[E0005]: refutable pattern in local binding
--> $DIR/empty-types.rs:112:9 --> $DIR/empty-types.rs:106:9
| |
LL | let Ok(_x) = &res_u32_never; LL | let Ok(_x) = &res_u32_never;
| ^^^^^^ pattern `&Err(_)` not covered | ^^^^^^ pattern `&Err(_)` not covered
@ -170,47 +147,56 @@ help: you might want to use `let else` to handle the variant that isn't matched
LL | let Ok(_x) = &res_u32_never else { todo!() }; LL | let Ok(_x) = &res_u32_never else { todo!() };
| ++++++++++++++++ | ++++++++++++++++
error[E0004]: non-exhaustive patterns: `Ok(_)` and `Err(_)` not covered error: unreachable pattern
--> $DIR/empty-types.rs:116:11 --> $DIR/empty-types.rs:112:9
| |
LL | match result_never {} LL | _ => {}
| ^^^^^^^^^^^^ patterns `Ok(_)` and `Err(_)` not covered | ^
| |
note: `Result<!, !>` defined here = note: this pattern matches no values because `Result<!, !>` is uninhabited
--> $SRC_DIR/core/src/result.rs:LL:COL
::: $SRC_DIR/core/src/result.rs:LL:COL
|
= note: not covered
::: $SRC_DIR/core/src/result.rs:LL:COL
|
= note: not covered
= note: the matched value is of type `Result<!, !>`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
LL ~ match result_never {
LL + Ok(_) | Err(_) => todo!(),
LL + }
|
error[E0004]: non-exhaustive patterns: `Err(_)` not covered
--> $DIR/empty-types.rs:121:11
|
LL | match result_never {
| ^^^^^^^^^^^^ pattern `Err(_)` not covered
|
note: `Result<!, !>` defined here
--> $SRC_DIR/core/src/result.rs:LL:COL
::: $SRC_DIR/core/src/result.rs:LL:COL
|
= note: not covered
= note: the matched value is of type `Result<!, !>`
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 | Ok(_) => {}, Err(_) => todo!()
| +++++++++++++++++++
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:140:13 --> $DIR/empty-types.rs:115:9
|
LL | Ok(_) => {}
| ^^^^^
|
= note: this pattern matches no values because `Result<!, !>` is uninhabited
error: unreachable pattern
--> $DIR/empty-types.rs:118:9
|
LL | Ok(_) => {}
| ^^^^^
|
= note: this pattern matches no values because `Result<!, !>` is uninhabited
error: unreachable pattern
--> $DIR/empty-types.rs:119:9
|
LL | _ => {}
| ^
|
= note: this pattern matches no values because `Result<!, !>` is uninhabited
error: unreachable pattern
--> $DIR/empty-types.rs:122:9
|
LL | Ok(_) => {}
| ^^^^^
|
= note: this pattern matches no values because `Result<!, !>` is uninhabited
error: unreachable pattern
--> $DIR/empty-types.rs:123:9
|
LL | Err(_) => {}
| ^^^^^^
|
= note: this pattern matches no values because `Result<!, !>` is uninhabited
error: unreachable pattern
--> $DIR/empty-types.rs:132:13
| |
LL | _ => {} LL | _ => {}
| ^ | ^
@ -218,33 +204,31 @@ LL | _ => {}
= note: this pattern matches no values because `Void` is uninhabited = note: this pattern matches no values because `Void` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:143:13 --> $DIR/empty-types.rs:135:13
| |
LL | _ if false => {} LL | _ if false => {}
| ^ | ^
| |
= note: this pattern matches no values because `Void` is uninhabited = note: this pattern matches no values because `Void` is uninhabited
error[E0004]: non-exhaustive patterns: `Some(_)` not covered error: unreachable pattern
--> $DIR/empty-types.rs:146:15 --> $DIR/empty-types.rs:143:13
| |
LL | match opt_void { LL | Some(_) => {}
| ^^^^^^^^ pattern `Some(_)` not covered | ^^^^^^^
| |
note: `Option<Void>` defined here = note: this pattern matches no values because `Void` is uninhabited
--> $SRC_DIR/core/src/option.rs:LL:COL
::: $SRC_DIR/core/src/option.rs:LL:COL error: unreachable pattern
| --> $DIR/empty-types.rs:147:13
= note: not covered
= note: the matched value is of type `Option<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
|
LL ~ None => {},
LL + Some(_) => todo!()
| |
LL | None => {}
| ---- matches all the values already
LL | _ => {}
| ^ unreachable pattern
error[E0004]: non-exhaustive patterns: `Some(_)` not covered error[E0004]: non-exhaustive patterns: `Some(_)` not covered
--> $DIR/empty-types.rs:165:15 --> $DIR/empty-types.rs:156:15
| |
LL | match *ref_opt_void { LL | match *ref_opt_void {
| ^^^^^^^^^^^^^ pattern `Some(_)` not covered | ^^^^^^^^^^^^^ pattern `Some(_)` not covered
@ -255,6 +239,7 @@ note: `Option<Void>` defined here
| |
= note: not covered = note: not covered
= note: the matched value is of type `Option<Void>` = note: the matched value is of type `Option<Void>`
= note: `Void` is uninhabited but is not being matched by value, so a wildcard `_` is required
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown 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 ~ None => {}, LL ~ None => {},
@ -262,7 +247,7 @@ LL + Some(_) => todo!()
| |
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:208:13 --> $DIR/empty-types.rs:199:13
| |
LL | _ => {} LL | _ => {}
| ^ | ^
@ -270,7 +255,7 @@ LL | _ => {}
= note: this pattern matches no values because `!` is uninhabited = note: this pattern matches no values because `!` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:213:13 --> $DIR/empty-types.rs:204:13
| |
LL | _ => {} LL | _ => {}
| ^ | ^
@ -278,7 +263,7 @@ LL | _ => {}
= note: this pattern matches no values because `!` is uninhabited = note: this pattern matches no values because `!` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:218:13 --> $DIR/empty-types.rs:209:13
| |
LL | _ => {} LL | _ => {}
| ^ | ^
@ -286,7 +271,7 @@ LL | _ => {}
= note: this pattern matches no values because `!` is uninhabited = note: this pattern matches no values because `!` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:223:13 --> $DIR/empty-types.rs:214:13
| |
LL | _ => {} LL | _ => {}
| ^ | ^
@ -294,7 +279,7 @@ LL | _ => {}
= note: this pattern matches no values because `!` is uninhabited = note: this pattern matches no values because `!` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:229:13 --> $DIR/empty-types.rs:220:13
| |
LL | _ => {} LL | _ => {}
| ^ | ^
@ -302,15 +287,39 @@ LL | _ => {}
= note: this pattern matches no values because `!` is uninhabited = note: this pattern matches no values because `!` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:288:9 --> $DIR/empty-types.rs:279:9
| |
LL | _ => {} LL | _ => {}
| ^ | ^
| |
= note: this pattern matches no values because `!` is uninhabited = note: this pattern matches no values because `!` is uninhabited
error: unreachable pattern
--> $DIR/empty-types.rs:282:9
|
LL | (_, _) => {}
| ^^^^^^
|
= note: this pattern matches no values because `(!, !)` is uninhabited
error: unreachable pattern
--> $DIR/empty-types.rs:285:9
|
LL | Ok(_) => {}
| ^^^^^
|
= note: this pattern matches no values because `Result<!, !>` is uninhabited
error: unreachable pattern
--> $DIR/empty-types.rs:286:9
|
LL | Err(_) => {}
| ^^^^^^
|
= note: this pattern matches no values because `Result<!, !>` is uninhabited
error[E0004]: non-exhaustive patterns: type `(u32, !)` is non-empty error[E0004]: non-exhaustive patterns: type `(u32, !)` is non-empty
--> $DIR/empty-types.rs:316:11 --> $DIR/empty-types.rs:307:11
| |
LL | match *x {} LL | match *x {}
| ^^ | ^^
@ -324,7 +333,7 @@ LL ~ }
| |
error[E0004]: non-exhaustive patterns: type `(!, !)` is non-empty error[E0004]: non-exhaustive patterns: type `(!, !)` is non-empty
--> $DIR/empty-types.rs:318:11 --> $DIR/empty-types.rs:309:11
| |
LL | match *x {} LL | match *x {}
| ^^ | ^^
@ -338,7 +347,7 @@ LL ~ }
| |
error[E0004]: non-exhaustive patterns: `Ok(_)` and `Err(_)` not covered error[E0004]: non-exhaustive patterns: `Ok(_)` and `Err(_)` not covered
--> $DIR/empty-types.rs:320:11 --> $DIR/empty-types.rs:311:11
| |
LL | match *x {} LL | match *x {}
| ^^ patterns `Ok(_)` and `Err(_)` not covered | ^^ patterns `Ok(_)` and `Err(_)` not covered
@ -360,7 +369,7 @@ LL ~ }
| |
error[E0004]: non-exhaustive patterns: type `[!; 3]` is non-empty error[E0004]: non-exhaustive patterns: type `[!; 3]` is non-empty
--> $DIR/empty-types.rs:322:11 --> $DIR/empty-types.rs:313:11
| |
LL | match *x {} LL | match *x {}
| ^^ | ^^
@ -374,7 +383,7 @@ LL ~ }
| |
error[E0004]: non-exhaustive patterns: type `&[!]` is non-empty error[E0004]: non-exhaustive patterns: type `&[!]` is non-empty
--> $DIR/empty-types.rs:327:11 --> $DIR/empty-types.rs:318:11
| |
LL | match slice_never {} LL | match slice_never {}
| ^^^^^^^^^^^ | ^^^^^^^^^^^
@ -388,12 +397,13 @@ LL + }
| |
error[E0004]: non-exhaustive patterns: `&[_, ..]` not covered error[E0004]: non-exhaustive patterns: `&[_, ..]` not covered
--> $DIR/empty-types.rs:329:11 --> $DIR/empty-types.rs:320:11
| |
LL | match slice_never { LL | match slice_never {
| ^^^^^^^^^^^ pattern `&[_, ..]` not covered | ^^^^^^^^^^^ pattern `&[_, ..]` not covered
| |
= note: the matched value is of type `&[!]` = note: the matched value is of type `&[!]`
= note: `!` is uninhabited but is not being matched by value, so a wildcard `_` is required
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown 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 ~ [] => {}, LL ~ [] => {},
@ -401,7 +411,7 @@ LL + &[_, ..] => todo!()
| |
error[E0004]: non-exhaustive patterns: `&[]`, `&[_]` and `&[_, _]` not covered error[E0004]: non-exhaustive patterns: `&[]`, `&[_]` and `&[_, _]` not covered
--> $DIR/empty-types.rs:338:11 --> $DIR/empty-types.rs:329:11
| |
LL | match slice_never { LL | match slice_never {
| ^^^^^^^^^^^ patterns `&[]`, `&[_]` and `&[_, _]` not covered | ^^^^^^^^^^^ patterns `&[]`, `&[_]` and `&[_, _]` not covered
@ -414,7 +424,7 @@ LL + &[] | &[_] | &[_, _] => todo!()
| |
error[E0004]: non-exhaustive patterns: `&[]` and `&[_, ..]` not covered error[E0004]: non-exhaustive patterns: `&[]` and `&[_, ..]` not covered
--> $DIR/empty-types.rs:352:11 --> $DIR/empty-types.rs:343:11
| |
LL | match slice_never { LL | match slice_never {
| ^^^^^^^^^^^ patterns `&[]` and `&[_, ..]` not covered | ^^^^^^^^^^^ patterns `&[]` and `&[_, ..]` not covered
@ -428,7 +438,7 @@ LL + &[] | &[_, ..] => todo!()
| |
error[E0004]: non-exhaustive patterns: type `[!]` is non-empty error[E0004]: non-exhaustive patterns: type `[!]` is non-empty
--> $DIR/empty-types.rs:359:11 --> $DIR/empty-types.rs:350:11
| |
LL | match *slice_never {} LL | match *slice_never {}
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
@ -441,22 +451,32 @@ LL + _ => todo!(),
LL + } LL + }
| |
error[E0004]: non-exhaustive patterns: type `[!; 3]` is non-empty error: unreachable pattern
--> $DIR/empty-types.rs:366:11 --> $DIR/empty-types.rs:359:9
| |
LL | match array_3_never {} LL | _ => {}
| ^^^^^^^^^^^^^ | ^
| |
= note: the matched value is of type `[!; 3]` = note: this pattern matches no values because `[!; 3]` is uninhabited
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown
error: unreachable pattern
--> $DIR/empty-types.rs:362:9
| |
LL ~ match array_3_never { LL | [_, _, _] => {}
LL + _ => todo!(), | ^^^^^^^^^
LL + }
| |
= note: this pattern matches no values because `[!; 3]` is uninhabited
error: unreachable pattern
--> $DIR/empty-types.rs:365:9
|
LL | [_, ..] => {}
| ^^^^^^^
|
= note: this pattern matches no values because `[!; 3]` is uninhabited
error[E0004]: non-exhaustive patterns: type `[!; 0]` is non-empty error[E0004]: non-exhaustive patterns: type `[!; 0]` is non-empty
--> $DIR/empty-types.rs:389:11 --> $DIR/empty-types.rs:379:11
| |
LL | match array_0_never {} LL | match array_0_never {}
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
@ -470,7 +490,7 @@ LL + }
| |
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:396:9 --> $DIR/empty-types.rs:386:9
| |
LL | [] => {} LL | [] => {}
| -- matches all the values already | -- matches all the values already
@ -478,7 +498,7 @@ LL | _ => {}
| ^ unreachable pattern | ^ unreachable pattern
error[E0004]: non-exhaustive patterns: `[]` not covered error[E0004]: non-exhaustive patterns: `[]` not covered
--> $DIR/empty-types.rs:398:11 --> $DIR/empty-types.rs:388:11
| |
LL | match array_0_never { LL | match array_0_never {
| ^^^^^^^^^^^^^ pattern `[]` not covered | ^^^^^^^^^^^^^ pattern `[]` not covered
@ -491,8 +511,42 @@ LL ~ [..] if false => {},
LL + [] => todo!() LL + [] => todo!()
| |
error: unreachable pattern
--> $DIR/empty-types.rs:407:9
|
LL | Some(_) => {}
| ^^^^^^^
|
= note: this pattern matches no values because `!` is uninhabited
error: unreachable pattern
--> $DIR/empty-types.rs:412:9
|
LL | Some(_a) => {}
| ^^^^^^^^
|
= note: this pattern matches no values because `!` is uninhabited
error: unreachable pattern
--> $DIR/empty-types.rs:417:9
|
LL | None => {}
| ---- matches all the values already
LL | // !useful, !reachable
LL | _ => {}
| ^ unreachable pattern
error: unreachable pattern
--> $DIR/empty-types.rs:422:9
|
LL | None => {}
| ---- matches all the values already
LL | // !useful, !reachable
LL | _a => {}
| ^^ unreachable pattern
error[E0004]: non-exhaustive patterns: `&Some(_)` not covered error[E0004]: non-exhaustive patterns: `&Some(_)` not covered
--> $DIR/empty-types.rs:452:11 --> $DIR/empty-types.rs:442:11
| |
LL | match ref_opt_never { LL | match ref_opt_never {
| ^^^^^^^^^^^^^ pattern `&Some(_)` not covered | ^^^^^^^^^^^^^ pattern `&Some(_)` not covered
@ -503,6 +557,7 @@ note: `Option<!>` defined here
| |
= note: not covered = note: not covered
= note: the matched value is of type `&Option<!>` = note: the matched value is of type `&Option<!>`
= note: `!` is uninhabited but is not being matched by value, so a wildcard `_` is required
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown 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 ~ &None => {}, LL ~ &None => {},
@ -510,7 +565,7 @@ LL + &Some(_) => todo!()
| |
error[E0004]: non-exhaustive patterns: `Some(_)` not covered error[E0004]: non-exhaustive patterns: `Some(_)` not covered
--> $DIR/empty-types.rs:493:11 --> $DIR/empty-types.rs:483:11
| |
LL | match *ref_opt_never { LL | match *ref_opt_never {
| ^^^^^^^^^^^^^^ pattern `Some(_)` not covered | ^^^^^^^^^^^^^^ pattern `Some(_)` not covered
@ -521,6 +576,7 @@ note: `Option<!>` defined here
| |
= note: not covered = note: not covered
= note: the matched value is of type `Option<!>` = note: the matched value is of type `Option<!>`
= note: `!` is uninhabited but is not being matched by value, so a wildcard `_` is required
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown 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 ~ None => {}, LL ~ None => {},
@ -528,7 +584,7 @@ LL + Some(_) => todo!()
| |
error[E0004]: non-exhaustive patterns: `Err(_)` not covered error[E0004]: non-exhaustive patterns: `Err(_)` not covered
--> $DIR/empty-types.rs:541:11 --> $DIR/empty-types.rs:531:11
| |
LL | match *ref_res_never { LL | match *ref_res_never {
| ^^^^^^^^^^^^^^ pattern `Err(_)` not covered | ^^^^^^^^^^^^^^ pattern `Err(_)` not covered
@ -539,6 +595,7 @@ note: `Result<!, !>` defined here
| |
= note: not covered = note: not covered
= note: the matched value is of type `Result<!, !>` = note: the matched value is of type `Result<!, !>`
= note: `!` is uninhabited but is not being matched by value, so a wildcard `_` is required
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown 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 ~ Ok(_) => {}, LL ~ Ok(_) => {},
@ -546,7 +603,7 @@ LL + Err(_) => todo!()
| |
error[E0004]: non-exhaustive patterns: `Err(_)` not covered error[E0004]: non-exhaustive patterns: `Err(_)` not covered
--> $DIR/empty-types.rs:552:11 --> $DIR/empty-types.rs:542:11
| |
LL | match *ref_res_never { LL | match *ref_res_never {
| ^^^^^^^^^^^^^^ pattern `Err(_)` not covered | ^^^^^^^^^^^^^^ pattern `Err(_)` not covered
@ -557,6 +614,7 @@ note: `Result<!, !>` defined here
| |
= note: not covered = note: not covered
= note: the matched value is of type `Result<!, !>` = note: the matched value is of type `Result<!, !>`
= note: `!` is uninhabited but is not being matched by value, so a wildcard `_` is required
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown 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 ~ Ok(_a) => {}, LL ~ Ok(_a) => {},
@ -564,7 +622,7 @@ LL + Err(_) => todo!()
| |
error[E0004]: non-exhaustive patterns: type `(u32, !)` is non-empty error[E0004]: non-exhaustive patterns: type `(u32, !)` is non-empty
--> $DIR/empty-types.rs:571:11 --> $DIR/empty-types.rs:561:11
| |
LL | match *ref_tuple_half_never {} LL | match *ref_tuple_half_never {}
| ^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^
@ -578,7 +636,7 @@ LL + }
| |
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:604:9 --> $DIR/empty-types.rs:594:9
| |
LL | _ => {} LL | _ => {}
| ^ | ^
@ -586,7 +644,7 @@ LL | _ => {}
= note: this pattern matches no values because `!` is uninhabited = note: this pattern matches no values because `!` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:607:9 --> $DIR/empty-types.rs:597:9
| |
LL | _x => {} LL | _x => {}
| ^^ | ^^
@ -594,7 +652,7 @@ LL | _x => {}
= note: this pattern matches no values because `!` is uninhabited = note: this pattern matches no values because `!` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:610:9 --> $DIR/empty-types.rs:600:9
| |
LL | _ if false => {} LL | _ if false => {}
| ^ | ^
@ -602,7 +660,7 @@ LL | _ if false => {}
= note: this pattern matches no values because `!` is uninhabited = note: this pattern matches no values because `!` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/empty-types.rs:613:9 --> $DIR/empty-types.rs:603:9
| |
LL | _x if false => {} LL | _x if false => {}
| ^^ | ^^
@ -610,12 +668,13 @@ LL | _x if false => {}
= note: this pattern matches no values because `!` is uninhabited = note: this pattern matches no values because `!` is uninhabited
error[E0004]: non-exhaustive patterns: `&_` not covered error[E0004]: non-exhaustive patterns: `&_` not covered
--> $DIR/empty-types.rs:638:11 --> $DIR/empty-types.rs:628:11
| |
LL | match ref_never { LL | match ref_never {
| ^^^^^^^^^ pattern `&_` not covered | ^^^^^^^^^ pattern `&_` not covered
| |
= note: the matched value is of type `&!` = note: the matched value is of type `&!`
= note: `!` is uninhabited but is not being matched by value, so a wildcard `_` is required
= note: references are always considered inhabited = note: references are always considered inhabited
= note: match arms with guards don't count towards exhaustivity = note: match arms with guards don't count towards exhaustivity
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
@ -625,7 +684,7 @@ LL + &_ => todo!()
| |
error[E0004]: non-exhaustive patterns: `Ok(_)` not covered error[E0004]: non-exhaustive patterns: `Ok(_)` not covered
--> $DIR/empty-types.rs:654:11 --> $DIR/empty-types.rs:644:11
| |
LL | match *ref_result_never { LL | match *ref_result_never {
| ^^^^^^^^^^^^^^^^^ pattern `Ok(_)` not covered | ^^^^^^^^^^^^^^^^^ pattern `Ok(_)` not covered
@ -636,6 +695,7 @@ note: `Result<!, !>` defined here
| |
= note: not covered = note: not covered
= note: the matched value is of type `Result<!, !>` = note: the matched value is of type `Result<!, !>`
= note: `!` is uninhabited but is not being matched by value, so a wildcard `_` is required
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown 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 ~ Err(_) => {}, LL ~ Err(_) => {},
@ -643,7 +703,7 @@ LL + Ok(_) => todo!()
| |
error[E0004]: non-exhaustive patterns: `Some(_)` not covered error[E0004]: non-exhaustive patterns: `Some(_)` not covered
--> $DIR/empty-types.rs:674:11 --> $DIR/empty-types.rs:664:11
| |
LL | match *x { LL | match *x {
| ^^ pattern `Some(_)` not covered | ^^ pattern `Some(_)` not covered
@ -654,13 +714,14 @@ note: `Option<Result<!, !>>` defined here
| |
= note: not covered = note: not covered
= note: the matched value is of type `Option<Result<!, !>>` = note: the matched value is of type `Option<Result<!, !>>`
= note: `Result<!, !>` is uninhabited but is not being matched by value, so a wildcard `_` is required
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown 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 ~ None => {}, LL ~ None => {},
LL + Some(_) => todo!() LL + Some(_) => todo!()
| |
error: aborting due to 49 previous errors error: aborting due to 64 previous errors
Some errors have detailed explanations: E0004, E0005. Some errors have detailed explanations: E0004, E0005.
For more information about an error, try `rustc --explain E0004`. For more information about an error, try `rustc --explain E0004`.

View file

@ -1,4 +1,4 @@
//@ revisions: normal min_exh_pats exhaustive_patterns never_pats //@ revisions: normal exhaustive_patterns never_pats
// //
// This tests correct handling of empty types in exhaustiveness checking. // This tests correct handling of empty types in exhaustiveness checking.
// //
@ -9,7 +9,6 @@
// This feature is useful to avoid `!` falling back to `()` all the time. // This feature is useful to avoid `!` falling back to `()` all the time.
#![feature(never_type_fallback)] #![feature(never_type_fallback)]
#![cfg_attr(exhaustive_patterns, feature(exhaustive_patterns))] #![cfg_attr(exhaustive_patterns, feature(exhaustive_patterns))]
#![cfg_attr(min_exh_pats, feature(min_exhaustive_patterns))]
#![cfg_attr(never_pats, feature(never_patterns))] #![cfg_attr(never_pats, feature(never_patterns))]
//[never_pats]~^ WARN the feature `never_patterns` is incomplete //[never_pats]~^ WARN the feature `never_patterns` is incomplete
#![allow(dead_code, unreachable_code)] #![allow(dead_code, unreachable_code)]
@ -67,19 +66,17 @@ fn basic(x: NeverBundle) {
let tuple_half_never: (u32, !) = x.tuple_half_never; let tuple_half_never: (u32, !) = x.tuple_half_never;
match tuple_half_never {} match tuple_half_never {}
//[normal,never_pats]~^ ERROR non-empty
match tuple_half_never { match tuple_half_never {
(_, _) => {} //[exhaustive_patterns,min_exh_pats]~ ERROR unreachable pattern (_, _) => {} //[exhaustive_patterns,normal,never_pats]~ ERROR unreachable pattern
} }
let tuple_never: (!, !) = x.tuple_never; let tuple_never: (!, !) = x.tuple_never;
match tuple_never {} match tuple_never {}
//[normal,never_pats]~^ ERROR non-empty
match tuple_never { match tuple_never {
_ => {} //[exhaustive_patterns,min_exh_pats]~ ERROR unreachable pattern _ => {} //[exhaustive_patterns,normal,never_pats]~ ERROR unreachable pattern
} }
match tuple_never { match tuple_never {
(_, _) => {} //[exhaustive_patterns,min_exh_pats]~ ERROR unreachable pattern (_, _) => {} //[exhaustive_patterns,normal,never_pats]~ ERROR unreachable pattern
} }
match tuple_never.0 {} match tuple_never.0 {}
match tuple_never.0 { match tuple_never.0 {
@ -90,44 +87,40 @@ fn basic(x: NeverBundle) {
match res_u32_never {} match res_u32_never {}
//~^ ERROR non-exhaustive //~^ ERROR non-exhaustive
match res_u32_never { match res_u32_never {
//[normal,never_pats]~^ ERROR non-exhaustive
Ok(_) => {} Ok(_) => {}
} }
match res_u32_never { match res_u32_never {
Ok(_) => {} Ok(_) => {}
Err(_) => {} //[exhaustive_patterns,min_exh_pats]~ ERROR unreachable pattern Err(_) => {} //[exhaustive_patterns,normal,never_pats]~ ERROR unreachable pattern
} }
match res_u32_never { match res_u32_never {
//~^ ERROR non-exhaustive //~^ ERROR non-exhaustive
Ok(0) => {} Ok(0) => {}
Err(_) => {} //[exhaustive_patterns,min_exh_pats]~ ERROR unreachable pattern Err(_) => {} //[exhaustive_patterns,normal,never_pats]~ ERROR unreachable pattern
} }
let Ok(_x) = res_u32_never; let Ok(_x) = res_u32_never;
//[normal,never_pats]~^ ERROR refutable
let Ok(_x) = res_u32_never.as_ref(); let Ok(_x) = res_u32_never.as_ref();
//~^ ERROR refutable //~^ ERROR refutable
// Non-obvious difference: here there's an implicit dereference in the patterns, which makes the // Non-obvious difference: here there's an implicit dereference in the patterns, which makes the
// inner place !known_valid. `exhaustive_patterns` ignores this. // inner place !known_valid. `exhaustive_patterns` ignores this.
let Ok(_x) = &res_u32_never; let Ok(_x) = &res_u32_never;
//[normal,min_exh_pats,never_pats]~^ ERROR refutable //[normal,never_pats]~^ ERROR refutable
let result_never: Result<!, !> = x.result_never; let result_never: Result<!, !> = x.result_never;
match result_never {} match result_never {}
//[normal,never_pats]~^ ERROR non-exhaustive
match result_never { match result_never {
_ => {} //[exhaustive_patterns,min_exh_pats]~ ERROR unreachable pattern _ => {} //[exhaustive_patterns,normal,never_pats]~ ERROR unreachable pattern
} }
match result_never { match result_never {
//[normal,never_pats]~^ ERROR non-exhaustive Ok(_) => {} //[exhaustive_patterns,normal,never_pats]~ ERROR unreachable pattern
Ok(_) => {} //[exhaustive_patterns,min_exh_pats]~ ERROR unreachable pattern
} }
match result_never { match result_never {
Ok(_) => {} //[exhaustive_patterns,min_exh_pats]~ ERROR unreachable pattern Ok(_) => {} //[exhaustive_patterns,normal,never_pats]~ ERROR unreachable pattern
_ => {} //[exhaustive_patterns,min_exh_pats]~ ERROR unreachable pattern _ => {} //[exhaustive_patterns,normal,never_pats]~ ERROR unreachable pattern
} }
match result_never { match result_never {
Ok(_) => {} //[exhaustive_patterns,min_exh_pats]~ ERROR unreachable pattern Ok(_) => {} //[exhaustive_patterns,normal,never_pats]~ ERROR unreachable pattern
Err(_) => {} //[exhaustive_patterns,min_exh_pats]~ ERROR unreachable pattern Err(_) => {} //[exhaustive_patterns,normal,never_pats]~ ERROR unreachable pattern
} }
} }
@ -143,16 +136,15 @@ fn void_same_as_never(x: NeverBundle) {
} }
let opt_void: Option<Void> = None; let opt_void: Option<Void> = None;
match opt_void { match opt_void {
//[normal,never_pats]~^ ERROR non-exhaustive
None => {} None => {}
} }
match opt_void { match opt_void {
None => {} None => {}
Some(_) => {} //[exhaustive_patterns,min_exh_pats]~ ERROR unreachable pattern Some(_) => {} //[exhaustive_patterns,normal,never_pats]~ ERROR unreachable pattern
} }
match opt_void { match opt_void {
None => {} None => {}
_ => {} //[exhaustive_patterns,min_exh_pats]~ ERROR unreachable pattern _ => {} //[exhaustive_patterns,normal,never_pats]~ ERROR unreachable pattern
} }
let ref_void: &Void = &x.void; let ref_void: &Void = &x.void;
@ -162,7 +154,7 @@ fn void_same_as_never(x: NeverBundle) {
} }
let ref_opt_void: &Option<Void> = &None; let ref_opt_void: &Option<Void> = &None;
match *ref_opt_void { match *ref_opt_void {
//[normal,min_exh_pats,never_pats]~^ ERROR non-exhaustive //[normal,never_pats]~^ ERROR non-exhaustive
None => {} None => {}
} }
match *ref_opt_void { match *ref_opt_void {
@ -287,11 +279,11 @@ fn nested_validity_tracking(bundle: NeverBundle) {
_ => {} //~ ERROR unreachable pattern _ => {} //~ ERROR unreachable pattern
} }
match tuple_never { match tuple_never {
(_, _) => {} //[exhaustive_patterns,min_exh_pats]~ ERROR unreachable pattern (_, _) => {} //[exhaustive_patterns,normal,never_pats]~ ERROR unreachable pattern
} }
match result_never { match result_never {
Ok(_) => {} //[exhaustive_patterns,min_exh_pats]~ ERROR unreachable pattern Ok(_) => {} //[exhaustive_patterns,normal,never_pats]~ ERROR unreachable pattern
Err(_) => {} //[exhaustive_patterns,min_exh_pats]~ ERROR unreachable pattern Err(_) => {} //[exhaustive_patterns,normal,never_pats]~ ERROR unreachable pattern
} }
// These should be considered !known_valid and not warn unreachable. // These should be considered !known_valid and not warn unreachable.
@ -312,13 +304,13 @@ fn invalid_empty_match(bundle: NeverBundle) {
match *x {} match *x {}
let x: &(u32, !) = &bundle.tuple_half_never; let x: &(u32, !) = &bundle.tuple_half_never;
match *x {} //[normal,min_exh_pats,never_pats]~ ERROR non-exhaustive match *x {} //[normal,never_pats]~ ERROR non-exhaustive
let x: &(!, !) = &bundle.tuple_never; let x: &(!, !) = &bundle.tuple_never;
match *x {} //[normal,min_exh_pats,never_pats]~ ERROR non-exhaustive match *x {} //[normal,never_pats]~ ERROR non-exhaustive
let x: &Result<!, !> = &bundle.result_never; let x: &Result<!, !> = &bundle.result_never;
match *x {} //[normal,min_exh_pats,never_pats]~ ERROR non-exhaustive match *x {} //[normal,never_pats]~ ERROR non-exhaustive
let x: &[!; 3] = &bundle.array_3_never; let x: &[!; 3] = &bundle.array_3_never;
match *x {} //[normal,min_exh_pats,never_pats]~ ERROR non-exhaustive match *x {} //[normal,never_pats]~ ERROR non-exhaustive
} }
fn arrays_and_slices(x: NeverBundle) { fn arrays_and_slices(x: NeverBundle) {
@ -326,7 +318,7 @@ fn arrays_and_slices(x: NeverBundle) {
match slice_never {} match slice_never {}
//~^ ERROR non-empty //~^ ERROR non-empty
match slice_never { match slice_never {
//[normal,min_exh_pats,never_pats]~^ ERROR not covered //[normal,never_pats]~^ ERROR not covered
[] => {} [] => {}
} }
match slice_never { match slice_never {
@ -335,7 +327,7 @@ fn arrays_and_slices(x: NeverBundle) {
[_, _, ..] => {} [_, _, ..] => {}
} }
match slice_never { match slice_never {
//[normal,min_exh_pats]~^ ERROR `&[]`, `&[_]` and `&[_, _]` not covered //[normal]~^ ERROR `&[]`, `&[_]` and `&[_, _]` not covered
//[exhaustive_patterns]~^^ ERROR `&[]` not covered //[exhaustive_patterns]~^^ ERROR `&[]` not covered
//[never_pats]~^^^ ERROR `&[]`, `&[!]` and `&[!, !]` not covered //[never_pats]~^^^ ERROR `&[]`, `&[!]` and `&[!, !]` not covered
[_, _, _, ..] => {} [_, _, _, ..] => {}
@ -349,7 +341,7 @@ fn arrays_and_slices(x: NeverBundle) {
_x => {} _x => {}
} }
match slice_never { match slice_never {
//[normal,min_exh_pats]~^ ERROR `&[]` and `&[_, ..]` not covered //[normal]~^ ERROR `&[]` and `&[_, ..]` not covered
//[exhaustive_patterns]~^^ ERROR `&[]` not covered //[exhaustive_patterns]~^^ ERROR `&[]` not covered
//[never_pats]~^^^ ERROR `&[]` and `&[!, ..]` not covered //[never_pats]~^^^ ERROR `&[]` and `&[!, ..]` not covered
&[..] if false => {} &[..] if false => {}
@ -363,15 +355,14 @@ fn arrays_and_slices(x: NeverBundle) {
let array_3_never: [!; 3] = x.array_3_never; let array_3_never: [!; 3] = x.array_3_never;
match array_3_never {} match array_3_never {}
//[normal,never_pats]~^ ERROR non-empty
match array_3_never { match array_3_never {
_ => {} //[exhaustive_patterns,min_exh_pats]~ ERROR unreachable pattern _ => {} //[exhaustive_patterns,normal,never_pats]~ ERROR unreachable pattern
} }
match array_3_never { match array_3_never {
[_, _, _] => {} //[exhaustive_patterns,min_exh_pats]~ ERROR unreachable pattern [_, _, _] => {} //[exhaustive_patterns,normal,never_pats]~ ERROR unreachable pattern
} }
match array_3_never { match array_3_never {
[_, ..] => {} //[exhaustive_patterns,min_exh_pats]~ ERROR unreachable pattern [_, ..] => {} //[exhaustive_patterns,normal,never_pats]~ ERROR unreachable pattern
} }
let ref_array_3_never: &[!; 3] = &array_3_never; let ref_array_3_never: &[!; 3] = &array_3_never;
@ -413,22 +404,22 @@ fn bindings(x: NeverBundle) {
match opt_never { match opt_never {
None => {} None => {}
// !useful, !reachable // !useful, !reachable
Some(_) => {} //[exhaustive_patterns,min_exh_pats]~ ERROR unreachable pattern Some(_) => {} //[exhaustive_patterns,normal,never_pats]~ ERROR unreachable pattern
} }
match opt_never { match opt_never {
None => {} None => {}
// !useful, !reachable // !useful, !reachable
Some(_a) => {} //[exhaustive_patterns,min_exh_pats]~ ERROR unreachable pattern Some(_a) => {} //[exhaustive_patterns,normal,never_pats]~ ERROR unreachable pattern
} }
match opt_never { match opt_never {
None => {} None => {}
// !useful, !reachable // !useful, !reachable
_ => {} //[exhaustive_patterns,min_exh_pats]~ ERROR unreachable pattern _ => {} //[exhaustive_patterns,normal,never_pats]~ ERROR unreachable pattern
} }
match opt_never { match opt_never {
None => {} None => {}
// !useful, !reachable // !useful, !reachable
_a => {} //[exhaustive_patterns,min_exh_pats]~ ERROR unreachable pattern _a => {} //[exhaustive_patterns,normal,never_pats]~ ERROR unreachable pattern
} }
// The scrutinee is known_valid, but under the `&` isn't anymore. // The scrutinee is known_valid, but under the `&` isn't anymore.
@ -449,7 +440,7 @@ fn bindings(x: NeverBundle) {
&_a => {} &_a => {}
} }
match ref_opt_never { match ref_opt_never {
//[normal,min_exh_pats,never_pats]~^ ERROR non-exhaustive //[normal,never_pats]~^ ERROR non-exhaustive
&None => {} &None => {}
} }
match ref_opt_never { match ref_opt_never {
@ -490,7 +481,7 @@ fn bindings(x: NeverBundle) {
ref _a => {} ref _a => {}
} }
match *ref_opt_never { match *ref_opt_never {
//[normal,min_exh_pats,never_pats]~^ ERROR non-exhaustive //[normal,never_pats]~^ ERROR non-exhaustive
None => {} None => {}
} }
match *ref_opt_never { match *ref_opt_never {
@ -538,7 +529,7 @@ fn bindings(x: NeverBundle) {
let ref_res_never: &Result<!, !> = &x.result_never; let ref_res_never: &Result<!, !> = &x.result_never;
match *ref_res_never { match *ref_res_never {
//[normal,min_exh_pats,never_pats]~^ ERROR non-exhaustive //[normal,never_pats]~^ ERROR non-exhaustive
// useful, reachable // useful, reachable
Ok(_) => {} Ok(_) => {}
} }
@ -549,7 +540,7 @@ fn bindings(x: NeverBundle) {
_ => {} _ => {}
} }
match *ref_res_never { match *ref_res_never {
//[normal,min_exh_pats,never_pats]~^ ERROR non-exhaustive //[normal,never_pats]~^ ERROR non-exhaustive
// useful, !reachable // useful, !reachable
Ok(_a) => {} Ok(_a) => {}
} }
@ -568,7 +559,7 @@ fn bindings(x: NeverBundle) {
let ref_tuple_half_never: &(u32, !) = &x.tuple_half_never; let ref_tuple_half_never: &(u32, !) = &x.tuple_half_never;
match *ref_tuple_half_never {} match *ref_tuple_half_never {}
//[normal,min_exh_pats,never_pats]~^ ERROR non-empty //[normal,never_pats]~^ ERROR non-empty
match *ref_tuple_half_never { match *ref_tuple_half_never {
// useful, reachable // useful, reachable
(_, _) => {} (_, _) => {}
@ -635,7 +626,7 @@ fn guards_and_validity(x: NeverBundle) {
_a if false => {} _a if false => {}
} }
match ref_never { match ref_never {
//[normal,min_exh_pats,never_pats]~^ ERROR non-exhaustive //[normal,never_pats]~^ ERROR non-exhaustive
// useful, !reachable // useful, !reachable
&_a if false => {} &_a if false => {}
} }
@ -651,7 +642,7 @@ fn guards_and_validity(x: NeverBundle) {
Err(_) => {} Err(_) => {}
} }
match *ref_result_never { match *ref_result_never {
//[normal,min_exh_pats]~^ ERROR `Ok(_)` not covered //[normal]~^ ERROR `Ok(_)` not covered
//[never_pats]~^^ ERROR `Ok(!)` not covered //[never_pats]~^^ ERROR `Ok(!)` not covered
// useful, reachable // useful, reachable
Ok(_) if false => {} Ok(_) if false => {}
@ -671,7 +662,7 @@ fn diagnostics_subtlety(x: NeverBundle) {
// Regression test for diagnostics: don't report `Some(Ok(_))` and `Some(Err(_))`. // Regression test for diagnostics: don't report `Some(Ok(_))` and `Some(Err(_))`.
let x: &Option<Result<!, !>> = &None; let x: &Option<Result<!, !>> = &None;
match *x { match *x {
//[normal,min_exh_pats]~^ ERROR `Some(_)` not covered //[normal]~^ ERROR `Some(_)` not covered
//[never_pats]~^^ ERROR `Some(!)` not covered //[never_pats]~^^ ERROR `Some(!)` not covered
None => {} None => {}
} }

View file

@ -1,5 +1,4 @@
#![feature(never_type)] #![feature(never_type)]
#![feature(min_exhaustive_patterns)]
#![deny(unreachable_patterns)] #![deny(unreachable_patterns)]
//~^ NOTE lint level is defined here //~^ NOTE lint level is defined here

View file

@ -1,5 +1,5 @@
error: unreachable pattern error: unreachable pattern
--> $DIR/explain-unreachable-pats.rs:11:9 --> $DIR/explain-unreachable-pats.rs:10:9
| |
LL | (1 | 2,) => {} LL | (1 | 2,) => {}
| -------- matches all the values already | -------- matches all the values already
@ -8,19 +8,19 @@ LL | (2,) => {}
| ^^^^ unreachable pattern | ^^^^ unreachable pattern
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/explain-unreachable-pats.rs:3:9 --> $DIR/explain-unreachable-pats.rs:2:9
| |
LL | #![deny(unreachable_patterns)] LL | #![deny(unreachable_patterns)]
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^
error: unreachable pattern error: unreachable pattern
--> $DIR/explain-unreachable-pats.rs:22:9 --> $DIR/explain-unreachable-pats.rs:21:9
| |
LL | (1 | 2,) => {} LL | (1 | 2,) => {}
| ^^^^^^^^ unreachable pattern | ^^^^^^^^ unreachable pattern
| |
note: these patterns collectively make the last one unreachable note: these patterns collectively make the last one unreachable
--> $DIR/explain-unreachable-pats.rs:22:9 --> $DIR/explain-unreachable-pats.rs:21:9
| |
LL | (1,) => {} LL | (1,) => {}
| ---- matches some of the same values | ---- matches some of the same values
@ -32,7 +32,7 @@ LL | (1 | 2,) => {}
| ^^^^^^^^ collectively making this unreachable | ^^^^^^^^ collectively making this unreachable
error: unreachable pattern error: unreachable pattern
--> $DIR/explain-unreachable-pats.rs:33:9 --> $DIR/explain-unreachable-pats.rs:32:9
| |
LL | Err(_) => {} LL | Err(_) => {}
| ^^^^^^ | ^^^^^^
@ -40,7 +40,7 @@ LL | Err(_) => {}
= note: this pattern matches no values because `!` is uninhabited = note: this pattern matches no values because `!` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/explain-unreachable-pats.rs:46:9 --> $DIR/explain-unreachable-pats.rs:45:9
| |
LL | (Err(_), Err(_)) => {} LL | (Err(_), Err(_)) => {}
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
@ -48,7 +48,7 @@ LL | (Err(_), Err(_)) => {}
= note: this pattern matches no values because `Void2` is uninhabited = note: this pattern matches no values because `Void2` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/explain-unreachable-pats.rs:52:9 --> $DIR/explain-unreachable-pats.rs:51:9
| |
LL | (Err(_), Err(_)) => {} LL | (Err(_), Err(_)) => {}
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
@ -56,7 +56,7 @@ LL | (Err(_), Err(_)) => {}
= note: this pattern matches no values because `Void1` is uninhabited = note: this pattern matches no values because `Void1` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/explain-unreachable-pats.rs:61:11 --> $DIR/explain-unreachable-pats.rs:60:11
| |
LL | if let (0 LL | if let (0
| - matches all the values already | - matches all the values already
@ -65,13 +65,13 @@ LL | | 0, _) = (0, 0) {}
| ^ unreachable pattern | ^ unreachable pattern
error: unreachable pattern error: unreachable pattern
--> $DIR/explain-unreachable-pats.rs:71:9 --> $DIR/explain-unreachable-pats.rs:70:9
| |
LL | (_, true) => {} LL | (_, true) => {}
| ^^^^^^^^^ unreachable pattern | ^^^^^^^^^ unreachable pattern
| |
note: these patterns collectively make the last one unreachable note: these patterns collectively make the last one unreachable
--> $DIR/explain-unreachable-pats.rs:71:9 --> $DIR/explain-unreachable-pats.rs:70:9
| |
LL | (true, _) => {} LL | (true, _) => {}
| --------- matches some of the same values | --------- matches some of the same values
@ -83,7 +83,7 @@ LL | (_, true) => {}
| ^^^^^^^^^ collectively making this unreachable | ^^^^^^^^^ collectively making this unreachable
error: unreachable pattern error: unreachable pattern
--> $DIR/explain-unreachable-pats.rs:84:9 --> $DIR/explain-unreachable-pats.rs:83:9
| |
LL | (true, _) => {} LL | (true, _) => {}
| --------- matches all the values already | --------- matches all the values already
@ -92,7 +92,7 @@ LL | (true, true) => {}
| ^^^^^^^^^^^^ unreachable pattern | ^^^^^^^^^^^^ unreachable pattern
error: unreachable pattern error: unreachable pattern
--> $DIR/explain-unreachable-pats.rs:96:9 --> $DIR/explain-unreachable-pats.rs:95:9
| |
LL | (_, true, 0..10) => {} LL | (_, true, 0..10) => {}
| ---------------- matches all the values already | ---------------- matches all the values already

View file

@ -1,5 +1,4 @@
#![feature(never_type)] #![feature(never_type)]
#![feature(min_exhaustive_patterns)]
#![feature(type_alias_impl_trait)] #![feature(type_alias_impl_trait)]
#![feature(non_exhaustive_omitted_patterns_lint)] #![feature(non_exhaustive_omitted_patterns_lint)]
#![deny(unreachable_patterns)] #![deny(unreachable_patterns)]

View file

@ -1,18 +1,18 @@
error: unreachable pattern error: unreachable pattern
--> $DIR/impl-trait.rs:17:13 --> $DIR/impl-trait.rs:16:13
| |
LL | _ => {} LL | _ => {}
| ^ | ^
| |
= note: this pattern matches no values because `Void` is uninhabited = note: this pattern matches no values because `Void` is uninhabited
note: the lint level is defined here note: the lint level is defined here
--> $DIR/impl-trait.rs:5:9 --> $DIR/impl-trait.rs:4:9
| |
LL | #![deny(unreachable_patterns)] LL | #![deny(unreachable_patterns)]
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^
error: unreachable pattern error: unreachable pattern
--> $DIR/impl-trait.rs:31:13 --> $DIR/impl-trait.rs:30:13
| |
LL | _ => {} LL | _ => {}
| ^ | ^
@ -20,7 +20,7 @@ LL | _ => {}
= note: this pattern matches no values because `Void` is uninhabited = note: this pattern matches no values because `Void` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/impl-trait.rs:45:13 --> $DIR/impl-trait.rs:44:13
| |
LL | Some(_) => {} LL | Some(_) => {}
| ^^^^^^^ | ^^^^^^^
@ -28,7 +28,7 @@ LL | Some(_) => {}
= note: this pattern matches no values because `Void` is uninhabited = note: this pattern matches no values because `Void` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/impl-trait.rs:49:13 --> $DIR/impl-trait.rs:48:13
| |
LL | None => {} LL | None => {}
| ---- matches all the values already | ---- matches all the values already
@ -36,7 +36,7 @@ LL | _ => {}
| ^ unreachable pattern | ^ unreachable pattern
error: unreachable pattern error: unreachable pattern
--> $DIR/impl-trait.rs:59:13 --> $DIR/impl-trait.rs:58:13
| |
LL | Some(_) => {} LL | Some(_) => {}
| ^^^^^^^ | ^^^^^^^
@ -44,7 +44,7 @@ LL | Some(_) => {}
= note: this pattern matches no values because `Void` is uninhabited = note: this pattern matches no values because `Void` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/impl-trait.rs:63:13 --> $DIR/impl-trait.rs:62:13
| |
LL | None => {} LL | None => {}
| ---- matches all the values already | ---- matches all the values already
@ -52,7 +52,7 @@ LL | _ => {}
| ^ unreachable pattern | ^ unreachable pattern
error: unreachable pattern error: unreachable pattern
--> $DIR/impl-trait.rs:76:9 --> $DIR/impl-trait.rs:75:9
| |
LL | _ => {} LL | _ => {}
| ^ | ^
@ -60,7 +60,7 @@ LL | _ => {}
= note: this pattern matches no values because `Void` is uninhabited = note: this pattern matches no values because `Void` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/impl-trait.rs:86:9 --> $DIR/impl-trait.rs:85:9
| |
LL | _ => {} LL | _ => {}
| - matches any value | - matches any value
@ -68,7 +68,7 @@ LL | Some((a, b)) => {}
| ^^^^^^^^^^^^ unreachable pattern | ^^^^^^^^^^^^ unreachable pattern
error: unreachable pattern error: unreachable pattern
--> $DIR/impl-trait.rs:94:13 --> $DIR/impl-trait.rs:93:13
| |
LL | _ => {} LL | _ => {}
| ^ | ^
@ -76,7 +76,7 @@ LL | _ => {}
= note: this pattern matches no values because `Void` is uninhabited = note: this pattern matches no values because `Void` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/impl-trait.rs:105:9 --> $DIR/impl-trait.rs:104:9
| |
LL | Some((a, b)) => {} LL | Some((a, b)) => {}
| ------------ matches all the values already | ------------ matches all the values already
@ -84,7 +84,7 @@ LL | Some((mut x, mut y)) => {
| ^^^^^^^^^^^^^^^^^^^^ unreachable pattern | ^^^^^^^^^^^^^^^^^^^^ unreachable pattern
error: unreachable pattern error: unreachable pattern
--> $DIR/impl-trait.rs:124:13 --> $DIR/impl-trait.rs:123:13
| |
LL | _ => {} LL | _ => {}
| - matches any value | - matches any value
@ -92,7 +92,7 @@ LL | Rec { n: 0, w: Some(Rec { n: 0, w: _ }) } => {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unreachable pattern | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unreachable pattern
error: unreachable pattern error: unreachable pattern
--> $DIR/impl-trait.rs:138:13 --> $DIR/impl-trait.rs:137:13
| |
LL | _ => {} LL | _ => {}
| ^ | ^
@ -100,7 +100,7 @@ LL | _ => {}
= note: this pattern matches no values because `SecretelyVoid` is uninhabited = note: this pattern matches no values because `SecretelyVoid` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/impl-trait.rs:151:13 --> $DIR/impl-trait.rs:150:13
| |
LL | _ => {} LL | _ => {}
| ^ | ^
@ -108,7 +108,7 @@ LL | _ => {}
= note: this pattern matches no values because `SecretelyDoubleVoid` is uninhabited = note: this pattern matches no values because `SecretelyDoubleVoid` is uninhabited
error[E0004]: non-exhaustive patterns: type `impl Copy` is non-empty error[E0004]: non-exhaustive patterns: type `impl Copy` is non-empty
--> $DIR/impl-trait.rs:23:11 --> $DIR/impl-trait.rs:22:11
| |
LL | match return_never_rpit(x) {} LL | match return_never_rpit(x) {}
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^
@ -122,7 +122,7 @@ LL + }
| |
error[E0004]: non-exhaustive patterns: type `T` is non-empty error[E0004]: non-exhaustive patterns: type `T` is non-empty
--> $DIR/impl-trait.rs:37:11 --> $DIR/impl-trait.rs:36:11
| |
LL | match return_never_tait(x) {} LL | match return_never_tait(x) {}
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^

View file

@ -1,5 +1,5 @@
error[E0004]: non-exhaustive patterns: `Some(Private { misc: true, .. })` not covered error[E0004]: non-exhaustive patterns: `Some(Private { misc: true, .. })` not covered
--> $DIR/match-privately-empty.rs:15:11 --> $DIR/match-privately-empty.rs:14:11
| |
LL | match private::DATA { LL | match private::DATA {
| ^^^^^^^^^^^^^ pattern `Some(Private { misc: true, .. })` not covered | ^^^^^^^^^^^^^ pattern `Some(Private { misc: true, .. })` not covered

View file

@ -0,0 +1,21 @@
error[E0004]: non-exhaustive patterns: `Some(Private { misc: true, .. })` not covered
--> $DIR/match-privately-empty.rs:14:11
|
LL | match private::DATA {
| ^^^^^^^^^^^^^ pattern `Some(Private { misc: true, .. })` not covered
|
note: `Option<Private>` defined here
--> $SRC_DIR/core/src/option.rs:LL:COL
::: $SRC_DIR/core/src/option.rs:LL:COL
|
= note: not covered
= note: the matched value is of type `Option<Private>`
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 ~ Some(private::Private { misc: false, .. }) => {},
LL + Some(Private { misc: true, .. }) => todo!()
|
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0004`.

View file

@ -1,6 +1,5 @@
//@ revisions: min_exhaustive_patterns exhaustive_patterns //@ revisions: normal exhaustive_patterns
#![cfg_attr(exhaustive_patterns, feature(exhaustive_patterns))] #![cfg_attr(exhaustive_patterns, feature(exhaustive_patterns))]
#![cfg_attr(min_exhaustive_patterns, feature(min_exhaustive_patterns))]
#![feature(never_type)] #![feature(never_type)]
mod private { mod private {

View file

@ -1,5 +1,5 @@
error[E0004]: non-exhaustive patterns: `&[]` not covered error[E0004]: non-exhaustive patterns: `&[]` not covered
--> $DIR/slice_of_empty.rs:21:11 --> $DIR/slice_of_empty.rs:20:11
| |
LL | match nevers { LL | match nevers {
| ^^^^^^ pattern `&[]` not covered | ^^^^^^ pattern `&[]` not covered

View file

@ -0,0 +1,30 @@
error[E0004]: non-exhaustive patterns: `&[_, ..]` not covered
--> $DIR/slice_of_empty.rs:9:11
|
LL | match nevers {
| ^^^^^^ pattern `&[_, ..]` not covered
|
= note: the matched value is of type `&[!]`
= note: `!` is uninhabited but is not being matched by value, so a wildcard `_` is required
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 ~ &[] => (),
LL ~ &[_, ..] => todo!(),
|
error[E0004]: non-exhaustive patterns: `&[]` and `&[_, _, ..]` not covered
--> $DIR/slice_of_empty.rs:20:11
|
LL | match nevers {
| ^^^^^^ patterns `&[]` and `&[_, _, ..]` not covered
|
= note: the matched value is of type `&[!]`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
LL ~ &[_] => (),
LL ~ &[] | &[_, _, ..] => todo!(),
|
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0004`.

View file

@ -1,6 +1,5 @@
//@ revisions: min_exhaustive_patterns exhaustive_patterns //@ revisions: normal exhaustive_patterns
#![cfg_attr(exhaustive_patterns, feature(exhaustive_patterns))] #![cfg_attr(exhaustive_patterns, feature(exhaustive_patterns))]
#![cfg_attr(min_exhaustive_patterns, feature(min_exhaustive_patterns))]
#![feature(never_type)] #![feature(never_type)]
#![deny(unreachable_patterns)] #![deny(unreachable_patterns)]
@ -8,7 +7,7 @@ fn main() {}
fn foo(nevers: &[!]) { fn foo(nevers: &[!]) {
match nevers { match nevers {
//[min_exhaustive_patterns]~^ ERROR non-exhaustive patterns: `&[_, ..]` not covered //[normal]~^ ERROR non-exhaustive patterns: `&[_, ..]` not covered
&[] => (), &[] => (),
}; };
@ -20,7 +19,7 @@ fn foo(nevers: &[!]) {
match nevers { match nevers {
//[exhaustive_patterns]~^ ERROR non-exhaustive patterns: `&[]` not covered //[exhaustive_patterns]~^ ERROR non-exhaustive patterns: `&[]` not covered
//[min_exhaustive_patterns]~^^ ERROR non-exhaustive patterns: `&[]` and `&[_, _, ..]` not covered //[normal]~^^ ERROR non-exhaustive patterns: `&[]` and `&[_, _, ..]` not covered
&[_] => (), &[_] => (),
}; };
} }

View file

@ -5,7 +5,6 @@
// `Ty::is_inhabited_from` function. // `Ty::is_inhabited_from` function.
#![feature(never_type)] #![feature(never_type)]
#![feature(never_type_fallback)] #![feature(never_type_fallback)]
#![feature(min_exhaustive_patterns)]
#![deny(unreachable_patterns)] #![deny(unreachable_patterns)]
macro_rules! assert_empty { macro_rules! assert_empty {

View file

@ -1,6 +1,4 @@
#![feature(never_type, never_type_fallback)] #![feature(never_type, never_type_fallback)]
#![feature(min_exhaustive_patterns)]
#![allow(unreachable_code)] #![allow(unreachable_code)]
#![deny(unreachable_patterns)] #![deny(unreachable_patterns)]

View file

@ -1,12 +1,12 @@
error: unreachable pattern error: unreachable pattern
--> $DIR/unreachable-loop-patterns.rs:18:9 --> $DIR/unreachable-loop-patterns.rs:16:9
| |
LL | for _ in unimplemented!() as Void {} LL | for _ in unimplemented!() as Void {}
| ^ | ^
| |
= note: this pattern matches no values because `Void` is uninhabited = note: this pattern matches no values because `Void` is uninhabited
note: the lint level is defined here note: the lint level is defined here
--> $DIR/unreachable-loop-patterns.rs:5:9 --> $DIR/unreachable-loop-patterns.rs:3:9
| |
LL | #![deny(unreachable_patterns)] LL | #![deny(unreachable_patterns)]
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^

View file

@ -11,22 +11,22 @@ macro_rules! never {
} }
fn no_arms_or_guards(x: Void) { fn no_arms_or_guards(x: Void) {
match None::<Void> { match &None::<Void> {
Some(!) => {} Some(!) => {}
//~^ ERROR a never pattern is always unreachable //~^ ERROR a never pattern is always unreachable
None => {} None => {}
} }
match None::<Void> { //~ ERROR: `Some(!)` not covered match &None::<Void> { //~ ERROR: `&Some(!)` not covered
Some(!) if true, Some(!) if true,
//~^ ERROR guard on a never pattern //~^ ERROR guard on a never pattern
None => {} None => {}
} }
match None::<Void> { //~ ERROR: `Some(!)` not covered match &None::<Void> { //~ ERROR: `&Some(!)` not covered
Some(!) if true => {} Some(!) if true => {}
//~^ ERROR a never pattern is always unreachable //~^ ERROR a never pattern is always unreachable
None => {} None => {}
} }
match None::<Void> { match &None::<Void> {
Some(never!()) => {} Some(never!()) => {}
//~^ ERROR a never pattern is always unreachable //~^ ERROR a never pattern is always unreachable
None => {} None => {}

View file

@ -31,40 +31,42 @@ LL | Some(never!()) => {}
| this will never be executed | this will never be executed
| help: remove this expression | help: remove this expression
error[E0004]: non-exhaustive patterns: `Some(!)` not covered error[E0004]: non-exhaustive patterns: `&Some(!)` not covered
--> $DIR/check.rs:19:11 --> $DIR/check.rs:19:11
| |
LL | match None::<Void> { LL | match &None::<Void> {
| ^^^^^^^^^^^^ pattern `Some(!)` not covered | ^^^^^^^^^^^^^ pattern `&Some(!)` not covered
| |
note: `Option<Void>` defined here note: `Option<Void>` defined here
--> $SRC_DIR/core/src/option.rs:LL:COL --> $SRC_DIR/core/src/option.rs:LL:COL
::: $SRC_DIR/core/src/option.rs:LL:COL ::: $SRC_DIR/core/src/option.rs:LL:COL
| |
= note: not covered = note: not covered
= note: the matched value is of type `Option<Void>` = note: the matched value is of type `&Option<Void>`
= note: `Void` is uninhabited but is not being matched by value, so a wildcard `_` is required
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown 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 ~ None => {}, LL ~ None => {},
LL + Some(!) LL + &Some(!)
| |
error[E0004]: non-exhaustive patterns: `Some(!)` not covered error[E0004]: non-exhaustive patterns: `&Some(!)` not covered
--> $DIR/check.rs:24:11 --> $DIR/check.rs:24:11
| |
LL | match None::<Void> { LL | match &None::<Void> {
| ^^^^^^^^^^^^ pattern `Some(!)` not covered | ^^^^^^^^^^^^^ pattern `&Some(!)` not covered
| |
note: `Option<Void>` defined here note: `Option<Void>` defined here
--> $SRC_DIR/core/src/option.rs:LL:COL --> $SRC_DIR/core/src/option.rs:LL:COL
::: $SRC_DIR/core/src/option.rs:LL:COL ::: $SRC_DIR/core/src/option.rs:LL:COL
| |
= note: not covered = note: not covered
= note: the matched value is of type `Option<Void>` = note: the matched value is of type `&Option<Void>`
= note: `Void` is uninhabited but is not being matched by value, so a wildcard `_` is required
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown 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 ~ None => {}, LL ~ None => {},
LL + Some(!) LL + &Some(!)
| |
error: aborting due to 6 previous errors error: aborting due to 6 previous errors

View file

@ -1,5 +1,5 @@
error: mismatched types error: mismatched types
--> $DIR/typeck.rs:25:9 --> $DIR/typeck.rs:24:9
| |
LL | !, LL | !,
| ^ a never pattern must be used on an uninhabited type | ^ a never pattern must be used on an uninhabited type
@ -7,7 +7,7 @@ LL | !,
= note: the matched value is of type `()` = note: the matched value is of type `()`
error: mismatched types error: mismatched types
--> $DIR/typeck.rs:29:9 --> $DIR/typeck.rs:28:9
| |
LL | !, LL | !,
| ^ a never pattern must be used on an uninhabited type | ^ a never pattern must be used on an uninhabited type
@ -15,7 +15,7 @@ LL | !,
= note: the matched value is of type `(i32, bool)` = note: the matched value is of type `(i32, bool)`
error: mismatched types error: mismatched types
--> $DIR/typeck.rs:33:13 --> $DIR/typeck.rs:32:13
| |
LL | (_, !), LL | (_, !),
| ^ a never pattern must be used on an uninhabited type | ^ a never pattern must be used on an uninhabited type
@ -23,7 +23,7 @@ LL | (_, !),
= note: the matched value is of type `bool` = note: the matched value is of type `bool`
error: mismatched types error: mismatched types
--> $DIR/typeck.rs:38:14 --> $DIR/typeck.rs:37:14
| |
LL | Some(!), LL | Some(!),
| ^ a never pattern must be used on an uninhabited type | ^ a never pattern must be used on an uninhabited type
@ -31,7 +31,7 @@ LL | Some(!),
= note: the matched value is of type `i32` = note: the matched value is of type `i32`
error: mismatched types error: mismatched types
--> $DIR/typeck.rs:45:9 --> $DIR/typeck.rs:44:9
| |
LL | !, LL | !,
| ^ a never pattern must be used on an uninhabited type | ^ a never pattern must be used on an uninhabited type
@ -39,7 +39,7 @@ LL | !,
= note: the matched value is of type `()` = note: the matched value is of type `()`
error: mismatched types error: mismatched types
--> $DIR/typeck.rs:52:9 --> $DIR/typeck.rs:51:9
| |
LL | !, LL | !,
| ^ a never pattern must be used on an uninhabited type | ^ a never pattern must be used on an uninhabited type
@ -47,7 +47,7 @@ LL | !,
= note: the matched value is of type `Option<Void>` = note: the matched value is of type `Option<Void>`
error: mismatched types error: mismatched types
--> $DIR/typeck.rs:57:9 --> $DIR/typeck.rs:56:9
| |
LL | !, LL | !,
| ^ a never pattern must be used on an uninhabited type | ^ a never pattern must be used on an uninhabited type
@ -55,7 +55,7 @@ LL | !,
= note: the matched value is of type `[Void]` = note: the matched value is of type `[Void]`
error: mismatched types error: mismatched types
--> $DIR/typeck.rs:63:9 --> $DIR/typeck.rs:62:9
| |
LL | !, LL | !,
| ^ a never pattern must be used on an uninhabited type | ^ a never pattern must be used on an uninhabited type

View file

@ -2,7 +2,6 @@
//@[pass] check-pass //@[pass] check-pass
//@[fail] check-fail //@[fail] check-fail
#![feature(never_patterns)] #![feature(never_patterns)]
#![feature(min_exhaustive_patterns)]
#![allow(incomplete_features)] #![allow(incomplete_features)]
#[derive(Copy, Clone)] #[derive(Copy, Clone)]

View file

@ -1,18 +1,18 @@
error: unreachable pattern error: unreachable pattern
--> $DIR/unreachable.rs:17:9 --> $DIR/unreachable.rs:16:9
| |
LL | Err(!), LL | Err(!),
| ^^^^^^ | ^^^^^^
| |
= note: this pattern matches no values because `Void` is uninhabited = note: this pattern matches no values because `Void` is uninhabited
note: the lint level is defined here note: the lint level is defined here
--> $DIR/unreachable.rs:7:9 --> $DIR/unreachable.rs:6:9
| |
LL | #![deny(unreachable_patterns)] LL | #![deny(unreachable_patterns)]
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^
error: unreachable pattern error: unreachable pattern
--> $DIR/unreachable.rs:20:19 --> $DIR/unreachable.rs:19:19
| |
LL | let (Ok(_x) | Err(!)) = res_void; LL | let (Ok(_x) | Err(!)) = res_void;
| ^^^^^^ | ^^^^^^
@ -20,7 +20,7 @@ LL | let (Ok(_x) | Err(!)) = res_void;
= note: this pattern matches no values because `Void` is uninhabited = note: this pattern matches no values because `Void` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/unreachable.rs:22:12 --> $DIR/unreachable.rs:21:12
| |
LL | if let Err(!) = res_void {} LL | if let Err(!) = res_void {}
| ^^^^^^ | ^^^^^^
@ -28,7 +28,7 @@ LL | if let Err(!) = res_void {}
= note: this pattern matches no values because `Void` is uninhabited = note: this pattern matches no values because `Void` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/unreachable.rs:24:24 --> $DIR/unreachable.rs:23:24
| |
LL | if let (Ok(true) | Err(!)) = res_void {} LL | if let (Ok(true) | Err(!)) = res_void {}
| ^^^^^^ | ^^^^^^
@ -36,7 +36,7 @@ LL | if let (Ok(true) | Err(!)) = res_void {}
= note: this pattern matches no values because `Void` is uninhabited = note: this pattern matches no values because `Void` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/unreachable.rs:26:23 --> $DIR/unreachable.rs:25:23
| |
LL | for (Ok(mut _x) | Err(!)) in [res_void] {} LL | for (Ok(mut _x) | Err(!)) in [res_void] {}
| ^^^^^^ | ^^^^^^
@ -44,7 +44,7 @@ LL | for (Ok(mut _x) | Err(!)) in [res_void] {}
= note: this pattern matches no values because `Void` is uninhabited = note: this pattern matches no values because `Void` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/unreachable.rs:30:18 --> $DIR/unreachable.rs:29:18
| |
LL | fn foo((Ok(_x) | Err(!)): Result<bool, Void>) {} LL | fn foo((Ok(_x) | Err(!)): Result<bool, Void>) {}
| ^^^^^^ | ^^^^^^

View file

@ -0,0 +1,44 @@
error: unreachable pattern
--> $DIR/unreachable.rs:16:9
|
LL | Err(!),
| ^^^^^^
|
note: the lint level is defined here
--> $DIR/unreachable.rs:6:9
|
LL | #![deny(unreachable_patterns)]
| ^^^^^^^^^^^^^^^^^^^^
error: unreachable pattern
--> $DIR/unreachable.rs:19:19
|
LL | let (Ok(_x) | Err(!)) = res_void;
| ^^^^^^
error: unreachable pattern
--> $DIR/unreachable.rs:21:12
|
LL | if let Err(!) = res_void {}
| ^^^^^^
error: unreachable pattern
--> $DIR/unreachable.rs:23:24
|
LL | if let (Ok(true) | Err(!)) = res_void {}
| ^^^^^^
error: unreachable pattern
--> $DIR/unreachable.rs:25:23
|
LL | for (Ok(mut _x) | Err(!)) in [res_void] {}
| ^^^^^^
error: unreachable pattern
--> $DIR/unreachable.rs:29:18
|
LL | fn foo((Ok(_x) | Err(!)): Result<bool, Void>) {}
| ^^^^^^
error: aborting due to 6 previous errors

View file

@ -1,8 +1,5 @@
//@ revisions: normal exh_pats
//@[normal] check-pass
#![feature(never_patterns)] #![feature(never_patterns)]
#![allow(incomplete_features)] #![allow(incomplete_features)]
#![cfg_attr(exh_pats, feature(min_exhaustive_patterns))]
#![allow(dead_code, unreachable_code)] #![allow(dead_code, unreachable_code)]
#![deny(unreachable_patterns)] #![deny(unreachable_patterns)]
@ -15,17 +12,17 @@ fn main() {
match res_void { match res_void {
Ok(_x) => {} Ok(_x) => {}
Err(!), Err(!),
//[exh_pats]~^ ERROR unreachable //~^ ERROR unreachable
} }
let (Ok(_x) | Err(!)) = res_void; let (Ok(_x) | Err(!)) = res_void;
//[exh_pats]~^ ERROR unreachable //~^ ERROR unreachable
if let Err(!) = res_void {} if let Err(!) = res_void {}
//[exh_pats]~^ ERROR unreachable //~^ ERROR unreachable
if let (Ok(true) | Err(!)) = res_void {} if let (Ok(true) | Err(!)) = res_void {}
//[exh_pats]~^ ERROR unreachable //~^ ERROR unreachable
for (Ok(mut _x) | Err(!)) in [res_void] {} for (Ok(mut _x) | Err(!)) in [res_void] {}
//[exh_pats]~^ ERROR unreachable //~^ ERROR unreachable
} }
fn foo((Ok(_x) | Err(!)): Result<bool, Void>) {} fn foo((Ok(_x) | Err(!)): Result<bool, Void>) {}
//[exh_pats]~^ ERROR unreachable //~^ ERROR unreachable

View file

@ -0,0 +1,55 @@
error: unreachable pattern
--> $DIR/unreachable.rs:14:9
|
LL | Err(!),
| ^^^^^^
|
= note: this pattern matches no values because `Void` is uninhabited
note: the lint level is defined here
--> $DIR/unreachable.rs:4:9
|
LL | #![deny(unreachable_patterns)]
| ^^^^^^^^^^^^^^^^^^^^
error: unreachable pattern
--> $DIR/unreachable.rs:17:19
|
LL | let (Ok(_x) | Err(!)) = res_void;
| ^^^^^^
|
= note: this pattern matches no values because `Void` is uninhabited
error: unreachable pattern
--> $DIR/unreachable.rs:19:12
|
LL | if let Err(!) = res_void {}
| ^^^^^^
|
= note: this pattern matches no values because `Void` is uninhabited
error: unreachable pattern
--> $DIR/unreachable.rs:21:24
|
LL | if let (Ok(true) | Err(!)) = res_void {}
| ^^^^^^
|
= note: this pattern matches no values because `Void` is uninhabited
error: unreachable pattern
--> $DIR/unreachable.rs:23:23
|
LL | for (Ok(mut _x) | Err(!)) in [res_void] {}
| ^^^^^^
|
= note: this pattern matches no values because `Void` is uninhabited
error: unreachable pattern
--> $DIR/unreachable.rs:27:18
|
LL | fn foo((Ok(_x) | Err(!)): Result<bool, Void>) {}
| ^^^^^^
|
= note: this pattern matches no values because `Void` is uninhabited
error: aborting due to 6 previous errors

View file

@ -1,3 +1,4 @@
//@ check-pass
#![feature(never_type)] #![feature(never_type)]
#[non_exhaustive] #[non_exhaustive]
@ -28,24 +29,24 @@ pub struct IndirectUninhabitedVariants(UninhabitedVariants);
struct A; struct A;
// This test checks that an empty match on a non-exhaustive uninhabited type through a level of // This test checks that an empty match on a non-exhaustive uninhabited type through a level of
// indirection from the defining crate will not compile without `#![feature(exhaustive_patterns)]`. // indirection from the defining crate compiles.
fn cannot_empty_match_on_empty_enum_to_anything(x: IndirectUninhabitedEnum) -> A { fn cannot_empty_match_on_empty_enum_to_anything(x: IndirectUninhabitedEnum) -> A {
match x {} //~ ERROR non-exhaustive patterns match x {}
} }
fn cannot_empty_match_on_empty_struct_to_anything(x: IndirectUninhabitedStruct) -> A { fn cannot_empty_match_on_empty_struct_to_anything(x: IndirectUninhabitedStruct) -> A {
match x {} //~ ERROR non-exhaustive patterns match x {}
} }
fn cannot_empty_match_on_empty_tuple_struct_to_anything(x: IndirectUninhabitedTupleStruct) -> A { fn cannot_empty_match_on_empty_tuple_struct_to_anything(x: IndirectUninhabitedTupleStruct) -> A {
match x {} //~ ERROR non-exhaustive patterns match x {}
} }
fn cannot_empty_match_on_enum_with_empty_variants_struct_to_anything( fn cannot_empty_match_on_enum_with_empty_variants_struct_to_anything(
x: IndirectUninhabitedVariants, x: IndirectUninhabitedVariants,
) -> A { ) -> A {
match x {} //~ ERROR non-exhaustive patterns match x {}
} }
fn main() {} fn main() {}

View file

@ -1,79 +0,0 @@
error[E0004]: non-exhaustive patterns: type `IndirectUninhabitedEnum` is non-empty
--> $DIR/indirect_match_same_crate.rs:34:11
|
LL | match x {}
| ^
|
note: `IndirectUninhabitedEnum` defined here
--> $DIR/indirect_match_same_crate.rs:20:12
|
LL | pub struct IndirectUninhabitedEnum(UninhabitedEnum);
| ^^^^^^^^^^^^^^^^^^^^^^^
= note: the matched value is of type `IndirectUninhabitedEnum`
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: type `IndirectUninhabitedStruct` is non-empty
--> $DIR/indirect_match_same_crate.rs:38:11
|
LL | match x {}
| ^
|
note: `IndirectUninhabitedStruct` defined here
--> $DIR/indirect_match_same_crate.rs:22:12
|
LL | pub struct IndirectUninhabitedStruct(UninhabitedStruct);
| ^^^^^^^^^^^^^^^^^^^^^^^^^
= note: the matched value is of type `IndirectUninhabitedStruct`
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: type `IndirectUninhabitedTupleStruct` is non-empty
--> $DIR/indirect_match_same_crate.rs:42:11
|
LL | match x {}
| ^
|
note: `IndirectUninhabitedTupleStruct` defined here
--> $DIR/indirect_match_same_crate.rs:24:12
|
LL | pub struct IndirectUninhabitedTupleStruct(UninhabitedTupleStruct);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: the matched value is of type `IndirectUninhabitedTupleStruct`
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: type `IndirectUninhabitedVariants` is non-empty
--> $DIR/indirect_match_same_crate.rs:48:11
|
LL | match x {}
| ^
|
note: `IndirectUninhabitedVariants` defined here
--> $DIR/indirect_match_same_crate.rs:26:12
|
LL | pub struct IndirectUninhabitedVariants(UninhabitedVariants);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: the matched value is of type `IndirectUninhabitedVariants`
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: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0004`.

View file

@ -1,6 +1,5 @@
//@ aux-build:uninhabited.rs //@ aux-build:uninhabited.rs
#![deny(unreachable_patterns)] #![deny(unreachable_patterns)]
#![feature(min_exhaustive_patterns)]
#![feature(never_type)] #![feature(never_type)]
extern crate uninhabited; extern crate uninhabited;

View file

@ -1,5 +1,5 @@
error[E0004]: non-exhaustive patterns: type `IndirectUninhabitedEnum` is non-empty error[E0004]: non-exhaustive patterns: type `IndirectUninhabitedEnum` is non-empty
--> $DIR/indirect_match_with_exhaustive_patterns.rs:23:11 --> $DIR/indirect_match_with_exhaustive_patterns.rs:22:11
| |
LL | match x {} LL | match x {}
| ^ | ^
@ -18,7 +18,7 @@ LL ~ }
| |
error[E0004]: non-exhaustive patterns: type `IndirectUninhabitedStruct` is non-empty error[E0004]: non-exhaustive patterns: type `IndirectUninhabitedStruct` is non-empty
--> $DIR/indirect_match_with_exhaustive_patterns.rs:27:11 --> $DIR/indirect_match_with_exhaustive_patterns.rs:26:11
| |
LL | match x {} LL | match x {}
| ^ | ^
@ -37,7 +37,7 @@ LL ~ }
| |
error[E0004]: non-exhaustive patterns: type `IndirectUninhabitedTupleStruct` is non-empty error[E0004]: non-exhaustive patterns: type `IndirectUninhabitedTupleStruct` is non-empty
--> $DIR/indirect_match_with_exhaustive_patterns.rs:31:11 --> $DIR/indirect_match_with_exhaustive_patterns.rs:30:11
| |
LL | match x {} LL | match x {}
| ^ | ^
@ -56,7 +56,7 @@ LL ~ }
| |
error[E0004]: non-exhaustive patterns: type `IndirectUninhabitedVariants` is non-empty error[E0004]: non-exhaustive patterns: type `IndirectUninhabitedVariants` is non-empty
--> $DIR/indirect_match_with_exhaustive_patterns.rs:37:11 --> $DIR/indirect_match_with_exhaustive_patterns.rs:36:11
| |
LL | match x {} LL | match x {}
| ^ | ^

View file

@ -1,7 +1,6 @@
//@ check-pass //@ check-pass
#![deny(unreachable_patterns)] #![deny(unreachable_patterns)]
#![feature(min_exhaustive_patterns)]
#![feature(never_type)] #![feature(never_type)]
#[non_exhaustive] #[non_exhaustive]

View file

@ -1,3 +1,4 @@
//@ check-pass
#![feature(never_type)] #![feature(never_type)]
#[non_exhaustive] #[non_exhaustive]
@ -27,15 +28,15 @@ fn cannot_empty_match_on_empty_enum_to_anything(x: UninhabitedEnum) -> A {
} }
fn cannot_empty_match_on_empty_struct_to_anything(x: UninhabitedStruct) -> A { fn cannot_empty_match_on_empty_struct_to_anything(x: UninhabitedStruct) -> A {
match x {} //~ ERROR non-exhaustive patterns match x {}
} }
fn cannot_empty_match_on_empty_tuple_struct_to_anything(x: UninhabitedTupleStruct) -> A { fn cannot_empty_match_on_empty_tuple_struct_to_anything(x: UninhabitedTupleStruct) -> A {
match x {} //~ ERROR non-exhaustive patterns match x {}
} }
fn cannot_empty_match_on_enum_with_empty_variants_struct_to_anything(x: UninhabitedVariants) -> A { fn cannot_empty_match_on_enum_with_empty_variants_struct_to_anything(x: UninhabitedVariants) -> A {
match x {} //~ ERROR non-exhaustive patterns match x {}
} }
fn main() {} fn main() {}

View file

@ -1,64 +0,0 @@
error[E0004]: non-exhaustive patterns: type `UninhabitedStruct` is non-empty
--> $DIR/match_same_crate.rs:30:11
|
LL | match x {}
| ^
|
note: `UninhabitedStruct` defined here
--> $DIR/match_same_crate.rs:8:12
|
LL | pub struct UninhabitedStruct {
| ^^^^^^^^^^^^^^^^^
= note: the matched value is of type `UninhabitedStruct`
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: type `UninhabitedTupleStruct` is non-empty
--> $DIR/match_same_crate.rs:34:11
|
LL | match x {}
| ^
|
note: `UninhabitedTupleStruct` defined here
--> $DIR/match_same_crate.rs:13:12
|
LL | pub struct UninhabitedTupleStruct(!);
| ^^^^^^^^^^^^^^^^^^^^^^
= note: the matched value is of type `UninhabitedTupleStruct`
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: `UninhabitedVariants::Tuple(_)` and `UninhabitedVariants::Struct { .. }` not covered
--> $DIR/match_same_crate.rs:38:11
|
LL | match x {}
| ^ patterns `UninhabitedVariants::Tuple(_)` and `UninhabitedVariants::Struct { .. }` not covered
|
note: `UninhabitedVariants` defined here
--> $DIR/match_same_crate.rs:15:10
|
LL | pub enum UninhabitedVariants {
| ^^^^^^^^^^^^^^^^^^^
LL | #[non_exhaustive] Tuple(!),
| ----- not covered
LL | #[non_exhaustive] Struct { x: ! }
| ------ not covered
= note: the matched value is of type `UninhabitedVariants`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
|
LL ~ match x {
LL + UninhabitedVariants::Tuple(_) | UninhabitedVariants::Struct { .. } => todo!(),
LL ~ }
|
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0004`.

View file

@ -1,6 +1,5 @@
//@ aux-build:uninhabited.rs //@ aux-build:uninhabited.rs
#![deny(unreachable_patterns)] #![deny(unreachable_patterns)]
#![feature(min_exhaustive_patterns)]
#![feature(never_type)] #![feature(never_type)]
extern crate uninhabited; extern crate uninhabited;

View file

@ -1,5 +1,5 @@
error[E0004]: non-exhaustive patterns: type `UninhabitedEnum` is non-empty error[E0004]: non-exhaustive patterns: type `UninhabitedEnum` is non-empty
--> $DIR/match_with_exhaustive_patterns.rs:22:11 --> $DIR/match_with_exhaustive_patterns.rs:21:11
| |
LL | match x {} LL | match x {}
| ^ | ^
@ -18,7 +18,7 @@ LL ~ }
| |
error[E0004]: non-exhaustive patterns: type `UninhabitedStruct` is non-empty error[E0004]: non-exhaustive patterns: type `UninhabitedStruct` is non-empty
--> $DIR/match_with_exhaustive_patterns.rs:26:11 --> $DIR/match_with_exhaustive_patterns.rs:25:11
| |
LL | match x {} LL | match x {}
| ^ | ^
@ -37,7 +37,7 @@ LL ~ }
| |
error[E0004]: non-exhaustive patterns: type `UninhabitedTupleStruct` is non-empty error[E0004]: non-exhaustive patterns: type `UninhabitedTupleStruct` is non-empty
--> $DIR/match_with_exhaustive_patterns.rs:30:11 --> $DIR/match_with_exhaustive_patterns.rs:29:11
| |
LL | match x {} LL | match x {}
| ^ | ^
@ -56,7 +56,7 @@ LL ~ }
| |
error[E0004]: non-exhaustive patterns: `UninhabitedVariants::Tuple(_)` and `UninhabitedVariants::Struct { .. }` not covered error[E0004]: non-exhaustive patterns: `UninhabitedVariants::Tuple(_)` and `UninhabitedVariants::Struct { .. }` not covered
--> $DIR/match_with_exhaustive_patterns.rs:34:11 --> $DIR/match_with_exhaustive_patterns.rs:33:11
| |
LL | match x {} LL | match x {}
| ^ patterns `UninhabitedVariants::Tuple(_)` and `UninhabitedVariants::Struct { .. }` not covered | ^ patterns `UninhabitedVariants::Tuple(_)` and `UninhabitedVariants::Struct { .. }` not covered

View file

@ -1,7 +1,6 @@
//@ check-pass //@ check-pass
#![deny(unreachable_patterns)] #![deny(unreachable_patterns)]
#![feature(min_exhaustive_patterns)]
#![feature(never_type)] #![feature(never_type)]
#[non_exhaustive] #[non_exhaustive]

View file

@ -1,7 +1,6 @@
//@ aux-build:uninhabited.rs //@ aux-build:uninhabited.rs
//@ build-pass (FIXME(62277): could be check-pass?) //@ build-pass (FIXME(62277): could be check-pass?)
#![deny(unreachable_patterns)] #![deny(unreachable_patterns)]
#![feature(min_exhaustive_patterns)]
extern crate uninhabited; extern crate uninhabited;

View file

@ -1,5 +1,4 @@
#![deny(unreachable_patterns)] #![deny(unreachable_patterns)]
#![feature(min_exhaustive_patterns)]
#![feature(never_type)] #![feature(never_type)]
#[non_exhaustive] #[non_exhaustive]

View file

@ -1,5 +1,5 @@
error: unreachable pattern error: unreachable pattern
--> $DIR/patterns_same_crate.rs:52:9 --> $DIR/patterns_same_crate.rs:51:9
| |
LL | Some(_x) => (), LL | Some(_x) => (),
| ^^^^^^^^ | ^^^^^^^^
@ -12,7 +12,7 @@ LL | #![deny(unreachable_patterns)]
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^
error: unreachable pattern error: unreachable pattern
--> $DIR/patterns_same_crate.rs:57:9 --> $DIR/patterns_same_crate.rs:56:9
| |
LL | Some(_x) => (), LL | Some(_x) => (),
| ^^^^^^^^ | ^^^^^^^^
@ -20,7 +20,7 @@ LL | Some(_x) => (),
= note: this pattern matches no values because `UninhabitedVariants` is uninhabited = note: this pattern matches no values because `UninhabitedVariants` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/patterns_same_crate.rs:61:15 --> $DIR/patterns_same_crate.rs:60:15
| |
LL | while let PartiallyInhabitedVariants::Struct { x } = partially_inhabited_variant() { LL | while let PartiallyInhabitedVariants::Struct { x } = partially_inhabited_variant() {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -28,7 +28,7 @@ LL | while let PartiallyInhabitedVariants::Struct { x } = partially_inhabite
= note: this pattern matches no values because `!` is uninhabited = note: this pattern matches no values because `!` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/patterns_same_crate.rs:65:15 --> $DIR/patterns_same_crate.rs:64:15
| |
LL | while let Some(_x) = uninhabited_struct() { LL | while let Some(_x) = uninhabited_struct() {
| ^^^^^^^^ | ^^^^^^^^
@ -36,7 +36,7 @@ LL | while let Some(_x) = uninhabited_struct() {
= note: this pattern matches no values because `UninhabitedStruct` is uninhabited = note: this pattern matches no values because `UninhabitedStruct` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/patterns_same_crate.rs:68:15 --> $DIR/patterns_same_crate.rs:67:15
| |
LL | while let Some(_x) = uninhabited_tuple_struct() { LL | while let Some(_x) = uninhabited_tuple_struct() {
| ^^^^^^^^ | ^^^^^^^^

View file

@ -31,7 +31,6 @@ impl<U, V> Try for MyResult<U, V> {
impl<U, V, W> FromResidual<MyResult<Never, V>> for MyResult<U, W> where V: Into<W> { impl<U, V, W> FromResidual<MyResult<Never, V>> for MyResult<U, W> where V: Into<W> {
fn from_residual(x: MyResult<Never, V>) -> Self { fn from_residual(x: MyResult<Never, V>) -> Self {
match x { match x {
MyResult::Awesome(u) => match u {},
MyResult::Terrible(e) => MyResult::Terrible(e.into()), MyResult::Terrible(e) => MyResult::Terrible(e.into()),
} }
} }
@ -42,7 +41,6 @@ type ResultResidual<E> = Result<std::convert::Infallible, E>;
impl<U, V, W> FromResidual<ResultResidual<V>> for MyResult<U, W> where V: Into<W> { impl<U, V, W> FromResidual<ResultResidual<V>> for MyResult<U, W> where V: Into<W> {
fn from_residual(x: ResultResidual<V>) -> Self { fn from_residual(x: ResultResidual<V>) -> Self {
match x { match x {
Ok(v) => match v {}
Err(e) => MyResult::Terrible(e.into()), Err(e) => MyResult::Terrible(e.into()),
} }
} }
@ -51,7 +49,6 @@ impl<U, V, W> FromResidual<ResultResidual<V>> for MyResult<U, W> where V: Into<W
impl<U, V, W> FromResidual<MyResult<Never, V>> for Result<U, W> where V: Into<W> { impl<U, V, W> FromResidual<MyResult<Never, V>> for Result<U, W> where V: Into<W> {
fn from_residual(x: MyResult<Never, V>) -> Self { fn from_residual(x: MyResult<Never, V>) -> Self {
match x { match x {
MyResult::Awesome(u) => match u {},
MyResult::Terrible(e) => Err(e.into()), MyResult::Terrible(e) => Err(e.into()),
} }
} }

View file

@ -1,7 +1,5 @@
//@ check-pass //@ check-pass
#![feature(min_exhaustive_patterns)]
enum Void {} enum Void {}
fn main() { fn main() {
let a: Option<Void> = None; let a: Option<Void> = None;

View file

@ -1,5 +1,5 @@
error[E0005]: refutable pattern in local binding error[E0005]: refutable pattern in local binding
--> $DIR/uninhabited-irrefutable.rs:31:9 --> $DIR/uninhabited-irrefutable.rs:30:9
| |
LL | let Foo::D(_y, _z) = x; LL | let Foo::D(_y, _z) = x;
| ^^^^^^^^^^^^^^ pattern `Foo::A(_)` not covered | ^^^^^^^^^^^^^^ pattern `Foo::A(_)` not covered
@ -7,7 +7,7 @@ LL | let Foo::D(_y, _z) = x;
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = 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: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
note: `Foo` defined here note: `Foo` defined here
--> $DIR/uninhabited-irrefutable.rs:20:6 --> $DIR/uninhabited-irrefutable.rs:19:6
| |
LL | enum Foo { LL | enum Foo {
| ^^^ | ^^^

View file

@ -0,0 +1,26 @@
error[E0005]: refutable pattern in local binding
--> $DIR/uninhabited-irrefutable.rs:30: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:19:6
|
LL | enum Foo {
| ^^^
LL |
LL | A(foo::SecretlyEmpty),
| - not covered
= note: pattern `Foo::A(_)` is currently uninhabited, but this variant contains private fields which may become inhabited in the future
= 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 1 previous error
For more information about this error, try `rustc --explain E0005`.

View file

@ -1,6 +1,5 @@
//@ revisions: min_exhaustive_patterns exhaustive_patterns //@ revisions: normal exhaustive_patterns
#![cfg_attr(exhaustive_patterns, feature(exhaustive_patterns))] #![cfg_attr(exhaustive_patterns, feature(exhaustive_patterns))]
#![cfg_attr(min_exhaustive_patterns, feature(min_exhaustive_patterns))]
#![feature(never_type)] #![feature(never_type)]
mod foo { mod foo {

View file

@ -15,10 +15,10 @@ fn main() {
let _ = match x {}; //~ ERROR non-exhaustive let _ = match x {}; //~ ERROR non-exhaustive
let x: (Void,) = unsafe { zeroed() }; let x: (Void,) = unsafe { zeroed() };
let _ = match x {}; //~ ERROR non-exhaustive let _ = match x {};
let x: [Void; 1] = unsafe { zeroed() }; let x: [Void; 1] = unsafe { zeroed() };
let _ = match x {}; //~ ERROR non-exhaustive let _ = match x {};
let x: &[Void] = unsafe { zeroed() }; let x: &[Void] = unsafe { zeroed() };
let _ = match x { //~ ERROR non-exhaustive let _ = match x { //~ ERROR non-exhaustive
@ -29,11 +29,10 @@ fn main() {
let _ = match x {}; // okay let _ = match x {}; // okay
let x: Result<u32, Void> = Ok(23); let x: Result<u32, Void> = Ok(23);
let _ = match x { //~ ERROR non-exhaustive let _ = match x {
Ok(x) => x, Ok(x) => x,
}; };
let x: Result<u32, Void> = Ok(23); let x: Result<u32, Void> = Ok(23);
let Ok(x) = x; let Ok(x) = x;
//~^ ERROR refutable
} }

View file

@ -36,34 +36,6 @@ LL + _ => todo!(),
LL ~ }; LL ~ };
| |
error[E0004]: non-exhaustive patterns: type `(Void,)` is non-empty
--> $DIR/uninhabited-matches-feature-gated.rs:18:19
|
LL | let _ = match x {};
| ^
|
= note: the matched value is of type `(Void,)`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown
|
LL ~ let _ = match x {
LL + _ => todo!(),
LL ~ };
|
error[E0004]: non-exhaustive patterns: type `[Void; 1]` is non-empty
--> $DIR/uninhabited-matches-feature-gated.rs:21:19
|
LL | let _ = match x {};
| ^
|
= note: the matched value is of type `[Void; 1]`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown
|
LL ~ let _ = match x {
LL + _ => todo!(),
LL ~ };
|
error[E0004]: non-exhaustive patterns: `&[_, ..]` not covered error[E0004]: non-exhaustive patterns: `&[_, ..]` not covered
--> $DIR/uninhabited-matches-feature-gated.rs:24:19 --> $DIR/uninhabited-matches-feature-gated.rs:24:19
| |
@ -71,45 +43,13 @@ LL | let _ = match x {
| ^ pattern `&[_, ..]` not covered | ^ pattern `&[_, ..]` not covered
| |
= note: the matched value is of type `&[Void]` = note: the matched value is of type `&[Void]`
= note: `Void` is uninhabited but is not being matched by value, so a wildcard `_` is required
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown 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 ~ &[] => (), LL ~ &[] => (),
LL ~ &[_, ..] => todo!(), LL ~ &[_, ..] => todo!(),
| |
error[E0004]: non-exhaustive patterns: `Err(_)` not covered error: aborting due to 3 previous errors
--> $DIR/uninhabited-matches-feature-gated.rs:32:19
|
LL | let _ = match x {
| ^ pattern `Err(_)` not covered
|
note: `Result<u32, Void>` defined here
--> $SRC_DIR/core/src/result.rs:LL:COL
::: $SRC_DIR/core/src/result.rs:LL:COL
|
= 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
|
LL ~ Ok(x) => x,
LL ~ Err(_) => todo!(),
|
error[E0005]: refutable pattern in local binding For more information about this error, try `rustc --explain E0004`.
--> $DIR/uninhabited-matches-feature-gated.rs:37:9
|
LL | let Ok(x) = x;
| ^^^^^ pattern `Err(_)` 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: the matched value is of type `Result<u32, Void>`
help: you might want to use `let else` to handle the variant that isn't matched
|
LL | let Ok(x) = x else { todo!() };
| ++++++++++++++++
error: aborting due to 7 previous errors
Some errors have detailed explanations: E0004, E0005.
For more information about an error, try `rustc --explain E0004`.

View file

@ -1,6 +1,5 @@
#![feature(box_patterns)] #![feature(box_patterns)]
#![feature(never_type)] #![feature(never_type)]
#![feature(min_exhaustive_patterns)]
#![deny(unreachable_patterns)] #![deny(unreachable_patterns)]
mod foo { mod foo {

View file

@ -1,18 +1,18 @@
error: unreachable pattern error: unreachable pattern
--> $DIR/uninhabited-patterns.rs:30:9 --> $DIR/uninhabited-patterns.rs:29:9
| |
LL | Ok(box _) => (), LL | Ok(box _) => (),
| ^^^^^^^^^ | ^^^^^^^^^
| |
= note: this pattern matches no values because `NotSoSecretlyEmpty` is uninhabited = note: this pattern matches no values because `NotSoSecretlyEmpty` is uninhabited
note: the lint level is defined here note: the lint level is defined here
--> $DIR/uninhabited-patterns.rs:4:9 --> $DIR/uninhabited-patterns.rs:3:9
| |
LL | #![deny(unreachable_patterns)] LL | #![deny(unreachable_patterns)]
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^
error: unreachable pattern error: unreachable pattern
--> $DIR/uninhabited-patterns.rs:39:9 --> $DIR/uninhabited-patterns.rs:38:9
| |
LL | Err(Ok(_y)) => (), LL | Err(Ok(_y)) => (),
| ^^^^^^^^^^^ | ^^^^^^^^^^^
@ -20,7 +20,7 @@ LL | Err(Ok(_y)) => (),
= note: this pattern matches no values because `NotSoSecretlyEmpty` is uninhabited = note: this pattern matches no values because `NotSoSecretlyEmpty` is uninhabited
error: unreachable pattern error: unreachable pattern
--> $DIR/uninhabited-patterns.rs:42:15 --> $DIR/uninhabited-patterns.rs:41:15
| |
LL | while let Some(_y) = foo() { LL | while let Some(_y) = foo() {
| ^^^^^^^^ | ^^^^^^^^