rust/tests/ui/closures/2229_closure_analysis/diagnostics/closure-origin-array-diagnostics.rs
2023-01-11 09:32:08 +00:00

14 lines
299 B
Rust

// edition:2021
// Test that array access is not stored as part of closure kind origin
fn expect_fn<F: Fn()>(_f: F) {}
fn main() {
let s = [format!("s"), format!("s")];
let c = || { //~ ERROR expected a closure that implements the `Fn`
let [_, _s] = s;
};
expect_fn(c);
}