rust/tests/run-pass/subslice_array.rs
2020-01-19 10:03:18 -06:00

12 lines
250 B
Rust

fn bar(a: &'static str, b: &'static str) -> [&'static str; 4] {
[a, b, b, a]
}
fn main() {
let out = bar("baz", "foo");
let [a, xs @ .., d] = out;
assert_eq!(a, "baz");
assert_eq!(xs, ["foo", "foo"]);
assert_eq!(d, "baz");
}