summaryrefslogtreecommitdiffstats
path: root/src/test/ui/binding/irrefutable-slice-patterns.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/test/ui/binding/irrefutable-slice-patterns.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/test/ui/binding/irrefutable-slice-patterns.rs b/src/test/ui/binding/irrefutable-slice-patterns.rs
new file mode 100644
index 000000000..048e1e5e9
--- /dev/null
+++ b/src/test/ui/binding/irrefutable-slice-patterns.rs
@@ -0,0 +1,14 @@
+// run-pass
+
+// Regression test for #47096.
+
+fn foo(s: &[i32]) -> &[i32] {
+ let &[ref xs @ ..] = s;
+ xs
+}
+
+fn main() {
+ let x = [1, 2, 3];
+ let y = foo(&x);
+ assert_eq!(x, y);
+}