diff options
Diffstat (limited to 'tests/ui/closures/2229_closure_analysis/diagnostics/closure-origin-array-diagnostics.rs')
-rw-r--r-- | tests/ui/closures/2229_closure_analysis/diagnostics/closure-origin-array-diagnostics.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/ui/closures/2229_closure_analysis/diagnostics/closure-origin-array-diagnostics.rs b/tests/ui/closures/2229_closure_analysis/diagnostics/closure-origin-array-diagnostics.rs new file mode 100644 index 000000000..f3be542e4 --- /dev/null +++ b/tests/ui/closures/2229_closure_analysis/diagnostics/closure-origin-array-diagnostics.rs @@ -0,0 +1,13 @@ +// 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); +} |