From 218caa410aa38c29984be31a5229b9fa717560ee Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:13 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- ...nboxed-closures-infer-fn-once-move-from-projection.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 tests/ui/unboxed-closures/unboxed-closures-infer-fn-once-move-from-projection.rs (limited to 'tests/ui/unboxed-closures/unboxed-closures-infer-fn-once-move-from-projection.rs') diff --git a/tests/ui/unboxed-closures/unboxed-closures-infer-fn-once-move-from-projection.rs b/tests/ui/unboxed-closures/unboxed-closures-infer-fn-once-move-from-projection.rs new file mode 100644 index 000000000..6e404c616 --- /dev/null +++ b/tests/ui/unboxed-closures/unboxed-closures-infer-fn-once-move-from-projection.rs @@ -0,0 +1,16 @@ +#![allow(unused)] + +fn foo(f: F) + where F: Fn() +{ +} + +fn main() { + // Test that this closure is inferred to `FnOnce` because it moves + // from `y.0`. This affects the error output (the error is that + // the closure implements `FnOnce`, not that it moves from inside + // a `Fn` closure.) + let y = (vec![1, 2, 3], 0); + let c = || drop(y.0); //~ ERROR expected a closure that implements the `Fn` trait + foo(c); +} -- cgit v1.2.3