rust/crates/parser/test_data/parser/ok/0072_destructuring_assignment.rs
Chayim Refael Friedman d9f0731bd2 Parse destructuring assignment
The only patterns we should parse are `..` in structs and `_`: the rest are either not supported or already valid expressions.
2022-03-02 01:51:25 +00:00

15 lines
285 B
Rust

fn foo() {
let (mut a, mut b) = (0, 1);
(b, a, ..) = (a, b);
(_) = ..;
struct S { a: i32 }
S { .. } = S { ..S::default() };
Some(..) = Some(0).
Ok(_) = 0;
let (a, b);
[a, .., b] = [1, .., 2];
(_, _) = (a, b);
(_) = (a, b);
_ = (a, b);
}