]> git.lizzy.rs Git - rust.git/blob - src/test/ui/borrowck/issue-51415.rs
Rollup merge of #102500 - compiler-errors:parse-sess-cleanup, r=cjgillot
[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 }