mirror of https://github.com/KaiserY/trpl-zh-cn
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
838 B
19 lines
838 B
3 years ago
|
$ cargo run
|
||
|
Compiling patterns v0.1.0 (file:///projects/patterns)
|
||
6 months ago
|
error[E0005]: refutable pattern in local binding
|
||
2 years ago
|
--> src/main.rs:3:9
|
||
|
|
|
||
|
3 | let Some(x) = some_option_value;
|
||
|
| ^^^^^^^ pattern `None` not covered
|
||
|
|
|
||
|
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
|
||
1 month ago
|
= note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html
|
||
2 years ago
|
= note: the matched value is of type `Option<i32>`
|
||
6 months ago
|
help: you might want to use `let else` to handle the variant that isn't matched
|
||
2 years ago
|
|
|
||
6 months ago
|
3 | let Some(x) = some_option_value else { todo!() };
|
||
|
| ++++++++++++++++
|
||
3 years ago
|
|
||
|
For more information about this error, try `rustc --explain E0005`.
|
||
6 months ago
|
error: could not compile `patterns` (bin "patterns") due to 1 previous error
|