summaryrefslogtreecommitdiffstats
path: root/tests/ui/borrowck/issue-51415.fixed
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/borrowck/issue-51415.fixed')
-rw-r--r--tests/ui/borrowck/issue-51415.fixed12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/ui/borrowck/issue-51415.fixed b/tests/ui/borrowck/issue-51415.fixed
new file mode 100644
index 000000000..92943f6c9
--- /dev/null
+++ b/tests/ui/borrowck/issue-51415.fixed
@@ -0,0 +1,12 @@
+// run-rustfix
+// Regression test for #51415: match default bindings were failing to
+// see the "move out" implied by `&s` below.
+
+fn main() {
+ let a = vec![String::from("a")];
+ let opt = a.iter().enumerate().find(|(_, &ref s)| {
+ //~^ ERROR cannot move out
+ *s == String::from("d")
+ }).map(|(i, _)| i);
+ println!("{:?}", opt);
+}