mirror of
https://github.com/rust-lang/rust
synced 2024-11-05 20:45:15 +00:00
28 lines
1.3 KiB
Text
28 lines
1.3 KiB
Text
error[E0658]: `X..` patterns in slices are experimental
|
|
--> $DIR/slice_pattern_syntax_problem1.rs:4:10
|
|
|
|
|
LL | let [a @ 3.., b @ ..3, c @ 4..6, ..] = xs;
|
|
| ^^^^^^^
|
|
|
|
|
= note: see issue #67264 <https://github.com/rust-lang/rust/issues/67264> for more information
|
|
= help: add `#![feature(half_open_range_patterns_in_slices)]` to the crate attributes to enable
|
|
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
|
|
|
error[E0005]: refutable pattern in local binding
|
|
--> $DIR/slice_pattern_syntax_problem1.rs:4:9
|
|
|
|
|
LL | let [a @ 3.., b @ ..3, c @ 4..6, ..] = xs;
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `[i32::MIN..=2_i32, ..]` 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 `[i32; 8]`
|
|
help: you might want to use `let else` to handle the variant that isn't matched
|
|
|
|
|
LL | let [a @ 3.., b @ ..3, c @ 4..6, ..] = xs else { todo!() };
|
|
| ++++++++++++++++
|
|
|
|
error: aborting due to 2 previous errors
|
|
|
|
Some errors have detailed explanations: E0005, E0658.
|
|
For more information about an error, try `rustc --explain E0005`.
|