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 --- tests/ui/fn/fn-trait-formatting.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tests/ui/fn/fn-trait-formatting.rs (limited to 'tests/ui/fn/fn-trait-formatting.rs') diff --git a/tests/ui/fn/fn-trait-formatting.rs b/tests/ui/fn/fn-trait-formatting.rs new file mode 100644 index 000000000..636ac7107 --- /dev/null +++ b/tests/ui/fn/fn-trait-formatting.rs @@ -0,0 +1,21 @@ +fn needs_fn(x: F) where F: Fn(isize) -> isize {} + + + +fn main() { + let _: () = Box::new(|_: isize| {}) as Box; + //~^ ERROR mismatched types + //~| expected unit type `()` + //~| found struct `Box` + let _: () = Box::new(|_: isize, isize| {}) as Box; + //~^ ERROR mismatched types + //~| expected unit type `()` + //~| found struct `Box` + let _: () = Box::new(|| -> isize { unimplemented!() }) as Box isize>; + //~^ ERROR mismatched types + //~| expected unit type `()` + //~| found struct `Box isize>` + + needs_fn(1); + //~^ ERROR expected a `Fn<(isize,)>` closure, found `{integer}` +} -- cgit v1.2.3