]> git.lizzy.rs Git - rust.git/blob - tests/ui/unboxed-closures/unboxed-closures-infer-fn-once-move-from-projection.rs
Rollup merge of #106856 - vadorovsky:fix-atomic-annotations, r=joshtriplett
[rust.git] / tests / ui / unboxed-closures / unboxed-closures-infer-fn-once-move-from-projection.rs
1 #![allow(unused)]
2
3 fn foo<F>(f: F)
4     where F: Fn()
5 {
6 }
7
8 fn main() {
9     // Test that this closure is inferred to `FnOnce` because it moves
10     // from `y.0`. This affects the error output (the error is that
11     // the closure implements `FnOnce`, not that it moves from inside
12     // a `Fn` closure.)
13     let y = (vec![1, 2, 3], 0);
14     let c = || drop(y.0); //~ ERROR expected a closure that implements the `Fn` trait
15     foo(c);
16 }