summaryrefslogtreecommitdiffstats
path: root/src/test/ui/borrowck/issue-51415.rs
blob: f031308fb7871ff4c2b6aa6a5bf20fb32fe8a23b (plain)
1
2
3
4
5
6
7
8
9
10
11
// 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(|(_, &s)| {
        //~^ ERROR cannot move out
        *s == String::from("d")
    }).map(|(i, _)| i);
    println!("{:?}", opt);
}