mirror of
https://github.com/rust-lang/rust
synced 2024-11-05 20:45:15 +00:00
12 lines
357 B
Rust
12 lines
357 B
Rust
//@ 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);
|
|
}
|