book/listings/ch18-patterns-and-matching/listing-18-08/output.txt

28 lines
1.3 KiB
Plaintext
Raw Normal View History

$ cargo run
Compiling patterns v0.1.0 (file:///projects/patterns)
error[E0005]: refutable pattern in local binding: `None` not covered
2022-11-04 01:55:26 +00:00
--> 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
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
2022-06-04 01:50:21 +00:00
note: `Option<i32>` defined here
2023-02-10 16:01:09 +00:00
--> /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/core/src/option.rs:518:1
|
= note:
/rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/core/src/option.rs:522:5: not covered
2022-11-04 01:55:26 +00:00
= note: the matched value is of type `Option<i32>`
2020-01-26 01:58:49 +00:00
help: you might want to use `if let` to ignore the variant that isn't matched
2022-11-04 01:55:26 +00:00
|
3 | let x = if let Some(x) = some_option_value { x } else { todo!() };
| ++++++++++ ++++++++++++++++++++++
2023-02-10 15:55:43 +00:00
help: alternatively, you might want to use let else to handle the variant that isn't matched
|
3 | let Some(x) = some_option_value else { todo!() };
| ++++++++++++++++
For more information about this error, try `rustc --explain E0005`.
2021-09-16 01:49:30 +00:00
error: could not compile `patterns` due to previous error