-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check bindings around never patterns
- Loading branch information
Showing
11 changed files
with
102 additions
and
104 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
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
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,19 +1,17 @@ | ||
error[E0408]: variable `_x` is not bound in all patterns | ||
--> $DIR/never_patterns.rs:12:19 | ||
error[E0005]: refutable pattern in local binding | ||
--> $DIR/never_patterns.rs:10:9 | ||
| | ||
LL | let (Ok(_x) | Err(!)) = &res; | ||
| -- ^^^^^^ pattern doesn't bind `_x` | ||
| | | ||
| variable not in all patterns | ||
|
||
error[E0408]: variable `_x` is not bound in all patterns | ||
--> $DIR/never_patterns.rs:14:19 | ||
LL | let Ok(_x) = res; | ||
| ^^^^^^ 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<T, Void>` | ||
help: you might want to use `let else` to handle the variant that isn't matched | ||
| | ||
LL | let (Ok(_x) | Err(&!)) = res.as_ref(); | ||
| -- ^^^^^^^ pattern doesn't bind `_x` | ||
| | | ||
| variable not in all patterns | ||
LL | let Ok(_x) = res else { todo!() }; | ||
| ++++++++++++++++ | ||
|
||
error: aborting due to 2 previous errors | ||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0408`. | ||
For more information about this error, try `rustc --explain E0005`. |
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
Oops, something went wrong.