From 64d98f8ee037282c35007b64c2649055c56af1db Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:03 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- tests/ui/borrowck/issue-51415.fixed | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 tests/ui/borrowck/issue-51415.fixed (limited to 'tests/ui/borrowck/issue-51415.fixed') 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); +} -- cgit v1.2.3