]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrowck/issue-51415.fixed
Rollup merge of #106707 - ehuss:remove-dupe-sha-1, r=Mark-Simulacrum
[rust.git] / tests / ui / borrowck / issue-51415.fixed
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(|(_, &ref s)| {
8         //~^ ERROR cannot move out
9         *s == String::from("d")
10     }).map(|(i, _)| i);
11     println!("{:?}", opt);
12 }