os-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.

77 lines
2.9 KiB
Text
Raw Permalink Normal View History

2022-12-23 21:02:23 +01:00
error[E0005]: refutable pattern in local binding
--> $DIR/const-pattern-irrefutable.rs:24:9
2017-11-04 03:01:56 +03:00
|
LL | const a: u8 = 2;
| ----------- missing patterns are not covered because `a` is interpreted as a constant pattern, not a new variable
...
2019-03-09 15:03:44 +03:00
LL | let a = 4;
2024-11-07 19:40:27 +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`
2024-11-07 19:40:27 +00:00
help: introduce a variable instead
|
LL | let a_var = 4;
| ~~~~~
2017-11-04 03:01:56 +03:00
2022-12-23 21:02:23 +01:00
error[E0005]: refutable pattern in local binding
--> $DIR/const-pattern-irrefutable.rs:28:9
2017-11-04 03:01:56 +03:00
|
LL | pub const b: u8 = 2;
| --------------- missing patterns are not covered because `b` is interpreted as a constant pattern, not a new variable
...
2019-03-09 15:03:44 +03:00
LL | let c = 4;
2024-11-07 19:40:27 +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`
2024-11-07 19:40:27 +00:00
help: introduce a variable instead
|
LL | let b_var = 4;
| ~~~~~
2017-11-04 03:01:56 +03:00
2022-12-23 21:02:23 +01:00
error[E0005]: refutable pattern in local binding
--> $DIR/const-pattern-irrefutable.rs:32:9
2017-11-04 03:01:56 +03:00
|
LL | pub const d: (u8, u8) = (2, 1);
| --------------------- missing patterns are not covered because `d` is interpreted as a constant pattern, not a new variable
...
LL | let d = (4, 4);
2024-11-07 19:40:27 +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, u8)`
2024-11-07 19:40:27 +00:00
help: introduce a variable instead
|
LL | let d_var = (4, 4);
| ~~~~~
error[E0005]: refutable pattern in local binding
--> $DIR/const-pattern-irrefutable.rs:36:9
|
LL | const e: S = S {
| ---------- missing patterns are not covered because `e` is interpreted as a constant pattern, not a new variable
...
LL | let e = S {
2024-11-07 19:40:27 +00:00
| ^ pattern `S { foo: 1_u8..=u8::MAX }` 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: `S` defined here
--> $DIR/const-pattern-irrefutable.rs:15:8
|
LL | struct S {
| ^
= note: the matched value is of type `S`
2024-11-07 19:40:27 +00:00
help: introduce a variable instead
|
LL | let e_var = S {
| ~~~~~
2017-11-04 03:01:56 +03:00
error: aborting due to 4 previous errors
2017-11-04 03:01:56 +03:00
2018-03-03 15:59:40 +01:00
For more information about this error, try `rustc --explain E0005`.