-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
address review: modify ICE-133063-never-arm-no-otherwise-block.rs
- Use enum Void to avoid mismatched types error - We don't need to use if let to check the ICE Signed-off-by: Shunpoco <tkngsnsk313320@gmail.com>
- Loading branch information
Showing
2 changed files
with
12 additions
and
43 deletions.
There are no files selected for viewing
15 changes: 5 additions & 10 deletions
15
tests/ui/rfcs/rfc-0000-never_patterns/ICE-133063-never-arm-no-otherwise-block.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 7 additions & 33 deletions
40
tests/ui/rfcs/rfc-0000-never_patterns/ICE-133063-never-arm-no-otherwise-block.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,11 @@ | ||
error: a never pattern is always unreachable | ||
--> $DIR/ICE-133063-never-arm-no-otherwise-block.rs:13:46 | ||
--> $DIR/ICE-133063-never-arm-no-otherwise-block.rs:10:31 | ||
| | ||
LL | !) if let _ = split_last(&()) => {} | ||
| ^^ | ||
| | | ||
| this will never be executed | ||
| help: remove this expression | ||
LL | (!|!) if false => {} | ||
| ^^ | ||
| | | ||
| this will never be executed | ||
| help: remove this expression | ||
|
||
error: mismatched types | ||
--> $DIR/ICE-133063-never-arm-no-otherwise-block.rs:12:14 | ||
| | ||
LL | (!| | ||
| ^ a never pattern must be used on an uninhabited type | ||
| | ||
= note: the matched value is of type `()` | ||
|
||
error: mismatched types | ||
--> $DIR/ICE-133063-never-arm-no-otherwise-block.rs:13:13 | ||
| | ||
LL | !) if let _ = split_last(&()) => {} | ||
| ^ a never pattern must be used on an uninhabited type | ||
| | ||
= note: the matched value is of type `()` | ||
|
||
warning: irrefutable `if let` guard pattern | ||
--> $DIR/ICE-133063-never-arm-no-otherwise-block.rs:13:19 | ||
| | ||
LL | !) if let _ = split_last(&()) => {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: this pattern will always match, so the guard is useless | ||
= help: consider removing the guard and adding a `let` inside the match arm | ||
= note: `#[warn(irrefutable_let_patterns)]` on by default | ||
|
||
error: aborting due to 3 previous errors; 1 warning emitted | ||
error: aborting due to 1 previous error | ||
|