2 #![feature(slice_patterns)]
6 fn foo<T: Add<Output=T> + Clone>([x, y, z]: [T; 3]) -> (T, T, T) {
7 (x.clone(), x.clone() + y.clone(), x + y + z)
9 fn bar(a: &'static str, b: &'static str) -> [&'static str; 4] {
14 assert_eq!(foo([1, 2, 3]), (1, 3, 6));
16 let [a, b, c, d] = bar("foo", "bar");
22 let [a, _, _, d] = bar("baz", "foo");
26 let out = bar("baz", "foo");
27 let [a, xs @ .., d] = out;
29 assert_eq!(xs, ["foo", "foo"]);