1
Fork 0

Auto merge of #128991 - Nadrieril:rustfix-unreachable-pattern, r=compiler-errors

Add a machine-applicable suggestion to "unreachable pattern"
This commit is contained in:
bors 2024-09-14 07:04:57 +00:00
commit f9567d0f2b
19 changed files with 502 additions and 98 deletions

View file

@ -2,7 +2,10 @@ error: unreachable pattern
--> $DIR/empty-match-check-notes.rs:17:9
|
LL | _ => {}
| ^ matches no values because `EmptyEnum` is uninhabited
| ^------
| |
| matches no values because `EmptyEnum` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
note: the lint level is defined here
@ -15,7 +18,10 @@ error: unreachable pattern
--> $DIR/empty-match-check-notes.rs:22:9
|
LL | _ if false => {}
| ^ matches no values because `EmptyEnum` is uninhabited
| ^---------------
| |
| matches no values because `EmptyEnum` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -23,7 +29,10 @@ error: unreachable pattern
--> $DIR/empty-match-check-notes.rs:31:9
|
LL | _ => {}
| ^ matches no values because `EmptyForeignEnum` is uninhabited
| ^------
| |
| matches no values because `EmptyForeignEnum` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -31,7 +40,10 @@ error: unreachable pattern
--> $DIR/empty-match-check-notes.rs:36:9
|
LL | _ if false => {}
| ^ matches no values because `EmptyForeignEnum` is uninhabited
| ^---------------
| |
| matches no values because `EmptyForeignEnum` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types

View file

@ -2,7 +2,10 @@ error: unreachable pattern
--> $DIR/empty-match-check-notes.rs:17:9
|
LL | _ => {}
| ^ matches no values because `EmptyEnum` is uninhabited
| ^------
| |
| matches no values because `EmptyEnum` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
note: the lint level is defined here
@ -15,7 +18,10 @@ error: unreachable pattern
--> $DIR/empty-match-check-notes.rs:22:9
|
LL | _ if false => {}
| ^ matches no values because `EmptyEnum` is uninhabited
| ^---------------
| |
| matches no values because `EmptyEnum` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -23,7 +29,10 @@ error: unreachable pattern
--> $DIR/empty-match-check-notes.rs:31:9
|
LL | _ => {}
| ^ matches no values because `EmptyForeignEnum` is uninhabited
| ^------
| |
| matches no values because `EmptyForeignEnum` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -31,7 +40,10 @@ error: unreachable pattern
--> $DIR/empty-match-check-notes.rs:36:9
|
LL | _ if false => {}
| ^ matches no values because `EmptyForeignEnum` is uninhabited
| ^---------------
| |
| matches no values because `EmptyForeignEnum` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types

View file

@ -2,7 +2,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:49:9
|
LL | _ => {}
| ^ matches no values because `!` is uninhabited
| ^------
| |
| matches no values because `!` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
note: the lint level is defined here
@ -15,7 +18,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:52:9
|
LL | _x => {}
| ^^ matches no values because `!` is uninhabited
| ^^------
| |
| matches no values because `!` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -38,7 +44,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:70:9
|
LL | (_, _) => {}
| ^^^^^^ matches no values because `(u32, !)` is uninhabited
| ^^^^^^------
| |
| matches no values because `(u32, !)` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -46,7 +55,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:76:9
|
LL | _ => {}
| ^ matches no values because `(!, !)` is uninhabited
| ^------
| |
| matches no values because `(!, !)` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -54,7 +66,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:79:9
|
LL | (_, _) => {}
| ^^^^^^ matches no values because `(!, !)` is uninhabited
| ^^^^^^------
| |
| matches no values because `(!, !)` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -62,7 +77,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:83:9
|
LL | _ => {}
| ^ matches no values because `!` is uninhabited
| ^------
| |
| matches no values because `!` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -89,7 +107,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:94:9
|
LL | Err(_) => {}
| ^^^^^^ matches no values because `!` is uninhabited
| ^^^^^^------
| |
| matches no values because `!` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -97,7 +118,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:99:9
|
LL | Err(_) => {}
| ^^^^^^ matches no values because `!` is uninhabited
| ^^^^^^------
| |
| matches no values because `!` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -137,7 +161,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:112:9
|
LL | _ => {}
| ^ matches no values because `Result<!, !>` is uninhabited
| ^------
| |
| matches no values because `Result<!, !>` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -145,7 +172,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:115:9
|
LL | Ok(_) => {}
| ^^^^^ matches no values because `Result<!, !>` is uninhabited
| ^^^^^------
| |
| matches no values because `Result<!, !>` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -153,7 +183,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:118:9
|
LL | Ok(_) => {}
| ^^^^^ matches no values because `Result<!, !>` is uninhabited
| ^^^^^------
| |
| matches no values because `Result<!, !>` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -161,7 +194,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:119:9
|
LL | _ => {}
| ^ matches no values because `Result<!, !>` is uninhabited
| ^------
| |
| matches no values because `Result<!, !>` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -169,7 +205,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:122:9
|
LL | Ok(_) => {}
| ^^^^^ matches no values because `Result<!, !>` is uninhabited
| ^^^^^------
| |
| matches no values because `Result<!, !>` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -177,7 +216,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:123:9
|
LL | Err(_) => {}
| ^^^^^^ matches no values because `Result<!, !>` is uninhabited
| ^^^^^^------
| |
| matches no values because `Result<!, !>` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -185,7 +227,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:132:13
|
LL | _ => {}
| ^ matches no values because `Void` is uninhabited
| ^------
| |
| matches no values because `Void` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -193,7 +238,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:135:13
|
LL | _ if false => {}
| ^ matches no values because `Void` is uninhabited
| ^---------------
| |
| matches no values because `Void` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -201,7 +249,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:143:13
|
LL | Some(_) => {}
| ^^^^^^^ matches no values because `Void` is uninhabited
| ^^^^^^^------
| |
| matches no values because `Void` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -217,7 +268,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:199:13
|
LL | _ => {}
| ^ matches no values because `!` is uninhabited
| ^------
| |
| matches no values because `!` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -225,7 +279,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:204:13
|
LL | _ => {}
| ^ matches no values because `!` is uninhabited
| ^------
| |
| matches no values because `!` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -233,7 +290,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:209:13
|
LL | _ => {}
| ^ matches no values because `!` is uninhabited
| ^------
| |
| matches no values because `!` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -241,7 +301,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:214:13
|
LL | _ => {}
| ^ matches no values because `!` is uninhabited
| ^------
| |
| matches no values because `!` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -249,7 +312,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:220:13
|
LL | _ => {}
| ^ matches no values because `!` is uninhabited
| ^------
| |
| matches no values because `!` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -257,7 +323,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:281:9
|
LL | _ => {}
| ^ matches no values because `!` is uninhabited
| ^------
| |
| matches no values because `!` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -265,7 +334,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:284:9
|
LL | (_, _) => {}
| ^^^^^^ matches no values because `(!, !)` is uninhabited
| ^^^^^^------
| |
| matches no values because `(!, !)` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -273,7 +345,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:287:9
|
LL | Ok(_) => {}
| ^^^^^ matches no values because `Result<!, !>` is uninhabited
| ^^^^^------
| |
| matches no values because `Result<!, !>` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -281,7 +356,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:288:9
|
LL | Err(_) => {}
| ^^^^^^ matches no values because `Result<!, !>` is uninhabited
| ^^^^^^------
| |
| matches no values because `Result<!, !>` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -344,7 +422,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:368:9
|
LL | _ => {}
| ^ matches no values because `[!; 3]` is uninhabited
| ^------
| |
| matches no values because `[!; 3]` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -352,7 +433,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:371:9
|
LL | [_, _, _] => {}
| ^^^^^^^^^ matches no values because `[!; 3]` is uninhabited
| ^^^^^^^^^------
| |
| matches no values because `[!; 3]` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -360,7 +444,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:374:9
|
LL | [_, ..] => {}
| ^^^^^^^ matches no values because `[!; 3]` is uninhabited
| ^^^^^^^------
| |
| matches no values because `[!; 3]` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -404,7 +491,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:416:9
|
LL | Some(_) => {}
| ^^^^^^^ matches no values because `!` is uninhabited
| ^^^^^^^------
| |
| matches no values because `!` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -412,7 +502,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:421:9
|
LL | Some(_a) => {}
| ^^^^^^^^ matches no values because `!` is uninhabited
| ^^^^^^^^------
| |
| matches no values because `!` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -438,7 +531,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:603:9
|
LL | _ => {}
| ^ matches no values because `!` is uninhabited
| ^------
| |
| matches no values because `!` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -446,7 +542,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:606:9
|
LL | _x => {}
| ^^ matches no values because `!` is uninhabited
| ^^------
| |
| matches no values because `!` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -454,7 +553,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:609:9
|
LL | _ if false => {}
| ^ matches no values because `!` is uninhabited
| ^---------------
| |
| matches no values because `!` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -462,7 +564,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:612:9
|
LL | _x if false => {}
| ^^ matches no values because `!` is uninhabited
| ^^---------------
| |
| matches no values because `!` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types

View file

@ -11,7 +11,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:49:9
|
LL | _ => {}
| ^ matches no values because `!` is uninhabited
| ^------
| |
| matches no values because `!` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
note: the lint level is defined here
@ -24,7 +27,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:52:9
|
LL | _x => {}
| ^^ matches no values because `!` is uninhabited
| ^^------
| |
| matches no values because `!` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -47,7 +53,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:83:9
|
LL | _ => {}
| ^ matches no values because `!` is uninhabited
| ^------
| |
| matches no values because `!` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -120,7 +129,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:132:13
|
LL | _ => {}
| ^ matches no values because `Void` is uninhabited
| ^------
| |
| matches no values because `Void` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -128,7 +140,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:135:13
|
LL | _ if false => {}
| ^ matches no values because `Void` is uninhabited
| ^---------------
| |
| matches no values because `Void` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -155,7 +170,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:199:13
|
LL | _ => {}
| ^ matches no values because `!` is uninhabited
| ^------
| |
| matches no values because `!` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -163,7 +181,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:204:13
|
LL | _ => {}
| ^ matches no values because `!` is uninhabited
| ^------
| |
| matches no values because `!` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -171,7 +192,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:209:13
|
LL | _ => {}
| ^ matches no values because `!` is uninhabited
| ^------
| |
| matches no values because `!` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -179,7 +203,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:214:13
|
LL | _ => {}
| ^ matches no values because `!` is uninhabited
| ^------
| |
| matches no values because `!` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -187,7 +214,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:220:13
|
LL | _ => {}
| ^ matches no values because `!` is uninhabited
| ^------
| |
| matches no values because `!` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -195,7 +225,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:281:9
|
LL | _ => {}
| ^ matches no values because `!` is uninhabited
| ^------
| |
| matches no values because `!` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -476,7 +509,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:603:9
|
LL | _ => {}
| ^ matches no values because `!` is uninhabited
| ^------
| |
| matches no values because `!` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -484,7 +520,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:606:9
|
LL | _x => {}
| ^^ matches no values because `!` is uninhabited
| ^^------
| |
| matches no values because `!` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -492,7 +531,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:609:9
|
LL | _ if false => {}
| ^ matches no values because `!` is uninhabited
| ^---------------
| |
| matches no values because `!` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -500,7 +542,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:612:9
|
LL | _x if false => {}
| ^^ matches no values because `!` is uninhabited
| ^^---------------
| |
| matches no values because `!` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types

View file

@ -2,7 +2,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:49:9
|
LL | _ => {}
| ^ matches no values because `!` is uninhabited
| ^------
| |
| matches no values because `!` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
note: the lint level is defined here
@ -15,7 +18,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:52:9
|
LL | _x => {}
| ^^ matches no values because `!` is uninhabited
| ^^------
| |
| matches no values because `!` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -38,7 +44,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:83:9
|
LL | _ => {}
| ^ matches no values because `!` is uninhabited
| ^------
| |
| matches no values because `!` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -111,7 +120,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:132:13
|
LL | _ => {}
| ^ matches no values because `Void` is uninhabited
| ^------
| |
| matches no values because `Void` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -119,7 +131,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:135:13
|
LL | _ if false => {}
| ^ matches no values because `Void` is uninhabited
| ^---------------
| |
| matches no values because `Void` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -146,7 +161,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:199:13
|
LL | _ => {}
| ^ matches no values because `!` is uninhabited
| ^------
| |
| matches no values because `!` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -154,7 +172,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:204:13
|
LL | _ => {}
| ^ matches no values because `!` is uninhabited
| ^------
| |
| matches no values because `!` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -162,7 +183,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:209:13
|
LL | _ => {}
| ^ matches no values because `!` is uninhabited
| ^------
| |
| matches no values because `!` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -170,7 +194,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:214:13
|
LL | _ => {}
| ^ matches no values because `!` is uninhabited
| ^------
| |
| matches no values because `!` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -178,7 +205,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:220:13
|
LL | _ => {}
| ^ matches no values because `!` is uninhabited
| ^------
| |
| matches no values because `!` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -186,7 +216,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:281:9
|
LL | _ => {}
| ^ matches no values because `!` is uninhabited
| ^------
| |
| matches no values because `!` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -467,7 +500,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:603:9
|
LL | _ => {}
| ^ matches no values because `!` is uninhabited
| ^------
| |
| matches no values because `!` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -475,7 +511,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:606:9
|
LL | _x => {}
| ^^ matches no values because `!` is uninhabited
| ^^------
| |
| matches no values because `!` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -483,7 +522,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:609:9
|
LL | _ if false => {}
| ^ matches no values because `!` is uninhabited
| ^---------------
| |
| matches no values because `!` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -491,7 +533,10 @@ error: unreachable pattern
--> $DIR/empty-types.rs:612:9
|
LL | _x if false => {}
| ^^ matches no values because `!` is uninhabited
| ^^---------------
| |
| matches no values because `!` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types

View file

@ -59,7 +59,10 @@ error: unreachable pattern
--> $DIR/explain-unreachable-pats.rs:52:9
|
LL | Err(_) => {}
| ^^^^^^ matches no values because `!` is uninhabited
| ^^^^^^------
| |
| matches no values because `!` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -67,7 +70,10 @@ error: unreachable pattern
--> $DIR/explain-unreachable-pats.rs:66:9
|
LL | (Err(_), Err(_)) => {}
| ^^^^^^^^^^^^^^^^ matches no values because `Void2` is uninhabited
| ^^^^^^^^^^^^^^^^------
| |
| matches no values because `Void2` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -75,7 +81,10 @@ error: unreachable pattern
--> $DIR/explain-unreachable-pats.rs:73:9
|
LL | (Err(_), Err(_)) => {}
| ^^^^^^^^^^^^^^^^ matches no values because `Void1` is uninhabited
| ^^^^^^^^^^^^^^^^------
| |
| matches no values because `Void1` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types

View file

@ -2,7 +2,10 @@ error: unreachable pattern
--> $DIR/impl-trait.rs:17:13
|
LL | _ => {}
| ^ matches no values because `Void` is uninhabited
| ^------
| |
| matches no values because `Void` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
note: the lint level is defined here
@ -15,7 +18,10 @@ error: unreachable pattern
--> $DIR/impl-trait.rs:31:13
|
LL | _ => {}
| ^ matches no values because `Void` is uninhabited
| ^------
| |
| matches no values because `Void` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -23,7 +29,10 @@ error: unreachable pattern
--> $DIR/impl-trait.rs:45:13
|
LL | Some(_) => {}
| ^^^^^^^ matches no values because `Void` is uninhabited
| ^^^^^^^------
| |
| matches no values because `Void` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -39,7 +48,10 @@ error: unreachable pattern
--> $DIR/impl-trait.rs:59:13
|
LL | Some(_) => {}
| ^^^^^^^ matches no values because `Void` is uninhabited
| ^^^^^^^------
| |
| matches no values because `Void` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -55,7 +67,10 @@ error: unreachable pattern
--> $DIR/impl-trait.rs:76:9
|
LL | _ => {}
| ^ matches no values because `Void` is uninhabited
| ^------
| |
| matches no values because `Void` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -71,7 +86,10 @@ error: unreachable pattern
--> $DIR/impl-trait.rs:94:13
|
LL | _ => {}
| ^ matches no values because `Void` is uninhabited
| ^------
| |
| matches no values because `Void` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -95,7 +113,10 @@ error: unreachable pattern
--> $DIR/impl-trait.rs:138:13
|
LL | _ => {}
| ^ matches no values because `SecretelyVoid` is uninhabited
| ^------
| |
| matches no values because `SecretelyVoid` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
@ -103,7 +124,10 @@ error: unreachable pattern
--> $DIR/impl-trait.rs:151:13
|
LL | _ => {}
| ^ matches no values because `SecretelyDoubleVoid` is uninhabited
| ^------
| |
| matches no values because `SecretelyDoubleVoid` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types

View file

@ -0,0 +1,23 @@
//@ run-rustfix
#![feature(never_patterns)]
#![feature(exhaustive_patterns)]
#![allow(incomplete_features)]
#![deny(unreachable_patterns)]
enum Void {}
#[rustfmt::skip]
fn main() {
let res: Result<(), Void> = Ok(());
match res {
Ok(_) => {}
//~ ERROR unreachable
//~ ERROR unreachable
}
match res {
Ok(_x) => {}
//~ ERROR unreachable
//~ ERROR unreachable
}
}

View file

@ -0,0 +1,23 @@
//@ run-rustfix
#![feature(never_patterns)]
#![feature(exhaustive_patterns)]
#![allow(incomplete_features)]
#![deny(unreachable_patterns)]
enum Void {}
#[rustfmt::skip]
fn main() {
let res: Result<(), Void> = Ok(());
match res {
Ok(_) => {}
Err(_) => {} //~ ERROR unreachable
Err(_) => {}, //~ ERROR unreachable
}
match res {
Ok(_x) => {}
Err(!), //~ ERROR unreachable
Err(!) //~ ERROR unreachable
}
}

View file

@ -0,0 +1,51 @@
error: unreachable pattern
--> $DIR/rustfix-unreachable-pattern.rs:14:9
|
LL | Err(_) => {}
| ^^^^^^------
| |
| matches no values because `Void` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
note: the lint level is defined here
--> $DIR/rustfix-unreachable-pattern.rs:5:9
|
LL | #![deny(unreachable_patterns)]
| ^^^^^^^^^^^^^^^^^^^^
error: unreachable pattern
--> $DIR/rustfix-unreachable-pattern.rs:15:9
|
LL | Err(_) => {},
| ^^^^^^-------
| |
| matches no values because `Void` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern
--> $DIR/rustfix-unreachable-pattern.rs:20:9
|
LL | Err(!),
| ^^^^^^-
| |
| matches no values because `Void` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: unreachable pattern
--> $DIR/rustfix-unreachable-pattern.rs:21:9
|
LL | Err(!)
| ^^^^^^
| |
| matches no values because `Void` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
error: aborting due to 4 previous errors

View file

@ -17,7 +17,10 @@ warning: unreachable pattern
--> $DIR/unreachable-try-pattern.rs:19:24
|
LL | let y = (match x { Ok(n) => Ok(n as u32), Err(e) => Err(e) })?;
| ^^^^^ matches no values because `!` is uninhabited
| ^^^^^-----------------
| |
| matches no values because `!` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
note: the lint level is defined here
@ -30,7 +33,10 @@ warning: unreachable pattern
--> $DIR/unreachable-try-pattern.rs:30:40
|
LL | let y = (match x { Ok(n) => Ok(n), Err(e) => Err(e) })?;
| ^^^^^^ matches no values because `Void` is uninhabited
| ^^^^^^----------
| |
| matches no values because `Void` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types

View file

@ -2,7 +2,10 @@ error: unreachable pattern
--> $DIR/unreachable.rs:15:9
|
LL | Err(!),
| ^^^^^^ matches no values because `Void` is uninhabited
| ^^^^^^-
| |
| matches no values because `Void` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
note: the lint level is defined here

View file

@ -2,7 +2,10 @@ error: unreachable pattern
--> $DIR/enum_same_crate_empty_match.rs:28:9
|
LL | _ => {}
| ^ matches no values because `EmptyNonExhaustiveEnum` is uninhabited
| ^------
| |
| matches no values because `EmptyNonExhaustiveEnum` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
note: the lint level is defined here

View file

@ -2,7 +2,10 @@ error: unreachable pattern
--> $DIR/patterns.rs:42:9
|
LL | Some(_x) => (),
| ^^^^^^^^ matches no values because `UninhabitedVariants` is uninhabited
| ^^^^^^^^-------
| |
| matches no values because `UninhabitedVariants` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
note: the lint level is defined here

View file

@ -2,7 +2,10 @@ error: unreachable pattern
--> $DIR/patterns_same_crate.rs:53:9
|
LL | Some(_x) => (),
| ^^^^^^^^ matches no values because `UninhabitedEnum` is uninhabited
| ^^^^^^^^-------
| |
| matches no values because `UninhabitedEnum` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
note: the lint level is defined here
@ -15,7 +18,10 @@ error: unreachable pattern
--> $DIR/patterns_same_crate.rs:58:9
|
LL | Some(_x) => (),
| ^^^^^^^^ matches no values because `UninhabitedVariants` is uninhabited
| ^^^^^^^^-------
| |
| matches no values because `UninhabitedVariants` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types

View file

@ -2,7 +2,10 @@ error: unreachable pattern
--> $DIR/uninhabited-patterns.rs:30:9
|
LL | Ok(box _) => (),
| ^^^^^^^^^ matches no values because `NotSoSecretlyEmpty` is uninhabited
| ^^^^^^^^^-------
| |
| matches no values because `NotSoSecretlyEmpty` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
note: the lint level is defined here
@ -15,7 +18,10 @@ error: unreachable pattern
--> $DIR/uninhabited-patterns.rs:39:9
|
LL | Err(Ok(_y)) => (),
| ^^^^^^^^^^^ matches no values because `NotSoSecretlyEmpty` is uninhabited
| ^^^^^^^^^^^-------
| |
| matches no values because `NotSoSecretlyEmpty` is uninhabited
| help: remove the match arm
|
= note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types