rust/tests/ui/consts/const-pattern-irrefutable.stderr

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

46 lines
1.9 KiB
Text
Raw Normal View History

2022-12-23 21:02:23 +01:00
error[E0005]: refutable pattern in local binding
2018-12-25 08:56:47 -07:00
--> $DIR/const-pattern-irrefutable.rs:12:9
2017-11-04 03:01:56 +03:00
|
2019-03-09 15:03:44 +03:00
LL | let a = 4;
2023-02-27 17:43:39 +00:00
| ^ patterns `0_u8..=1_u8` and `3_u8..=u8::MAX` not covered
|
2023-02-27 17:43:39 +00:00
= 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 `u8`
2023-02-27 17:43:39 +00:00
help: you might want to use `if let` to ignore the variants that aren't matched
|
LL | if let a = 4 { todo!() };
| ++ +++++++++++
2017-11-04 03:01:56 +03:00
2022-12-23 21:02:23 +01:00
error[E0005]: refutable pattern in local binding
2023-02-27 17:43:39 +00:00
--> $DIR/const-pattern-irrefutable.rs:16:9
2017-11-04 03:01:56 +03:00
|
2019-03-09 15:03:44 +03:00
LL | let c = 4;
2023-02-27 17:43:39 +00:00
| ^ patterns `0_u8..=1_u8` and `3_u8..=u8::MAX` not covered
|
2023-02-27 17:43:39 +00:00
= 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 `u8`
2023-02-27 17:43:39 +00:00
help: you might want to use `if let` to ignore the variants that aren't matched
|
LL | if let c = 4 { todo!() };
| ++ +++++++++++
2017-11-04 03:01:56 +03:00
2022-12-23 21:02:23 +01:00
error[E0005]: refutable pattern in local binding
2023-02-27 17:43:39 +00:00
--> $DIR/const-pattern-irrefutable.rs:20:9
2017-11-04 03:01:56 +03:00
|
2019-03-09 15:03:44 +03:00
LL | let d = 4;
2023-02-27 17:43:39 +00:00
| ^ patterns `0_u8..=1_u8` and `3_u8..=u8::MAX` not covered
|
2023-02-27 17:43:39 +00:00
= 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 `u8`
2023-02-27 17:43:39 +00:00
help: you might want to use `if let` to ignore the variants that aren't matched
|
LL | if let d = 4 { todo!() };
| ++ +++++++++++
2017-11-04 03:01:56 +03:00
error: aborting due to 3 previous errors
2018-03-03 15:59:40 +01:00
For more information about this error, try `rustc --explain E0005`.