]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrowck/issue-51415.rs
Merge commit '7f27e2e74ef957baa382dc05cf08df6368165c74' into clippyup
[rust.git] / tests / ui / borrowck / issue-51415.rs
1 // run-rustfix
2 // Regression test for #51415: match default bindings were failing to
3 // see the "move out" implied by `&s` below.
4
5 fn main() {
6     let a = vec![String::from("a")];
7     let opt = a.iter().enumerate().find(|(_, &s)| {
8         //~^ ERROR cannot move out
9         *s == String::from("d")
10     }).map(|(i, _)| i);
11     println!("{:?}", opt);
12 }