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