Open tcr opened 7 years ago
Would slice patterns in nightly rustc work? https://doc.rust-lang.org/book/slice-patterns.html
Alternatively, use a pattern guard in a match?
Pattern guards are a good choice here, I think the pattern is just []
and non_empty_vec
throughout the code!
Slice patterns would work, though only at the top-level. Pattern matching against Vectors and Strings is not possible unless they're converted into boxed objects first (and box_patterns is enabled), so I should get more data on how they're used.
Say we're matching:
This won't work in Rust if you try to match against a container. Unless
box []
pattern works. Does this need an extensive AST transform to work?