rust/tests/ui/binding/irrefutable-slice-patterns.rs

15 lines
193 B
Rust
Raw Normal View History

// run-pass
2019-12-30 00:23:42 +00:00
// Regression test for #47096.
fn foo(s: &[i32]) -> &[i32] {
2019-07-07 23:47:46 +00:00
let &[ref xs @ ..] = s;
xs
}
fn main() {
let x = [1, 2, 3];
let y = foo(&x);
assert_eq!(x, y);
}