-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for binding sub-arrays using slice patterns #707
Comments
We currently don't handle the head/tail pattern fully. Add an appropriate error message and add to the limitations section of the docs, then we can remove the "MLP - Must Have" and change it from a bug to a feature. |
With #1066, this no longer crashes, and instead we codegen assert/assume false that will cause verification to fail if the array subslice pattern is reachable. Removing the "MLP - Must Have" label. |
fn array() -> [(String, String); 3] {
Default::default()
}
#[kani::proof]
fn move_out_by_const_subslice_and_index_field() {
let a = array();
let [_, _y @ ..] = a;
let [(ref _x, _), _, _] = a;
}
#[kani::proof]
fn move_out_by_const_subslice_and_end_index_field() {
let a = array();
let [_y @ .., _] = a;
let [.., (ref _x, _)] = a;
}
// Slice + Slice
#[kani::proof]
fn move_out_by_subslice_and_subslice() {
let a = array();
let [x @ .., _, _] = a;
let [_, ref _y @ ..] = a;
} with mir-opt-level=3: |
Requested feature: Add full support for Rust slice patterns. Currently, only binding sub-slices is supported (see #357). Binding sub-arrays panics.
Use case: Slice patterns
Link to relevant documentation (Rust reference, Nomicon, RFC): https://rust-lang.github.io/rfcs/2359-subslice-pattern-syntax.html
Is this a breaking change? No
Test case:
The text was updated successfully, but these errors were encountered: