diff options
Diffstat (limited to 'tests/ui/unboxed-closures/unboxed-closures-prelude.rs')
-rw-r--r-- | tests/ui/unboxed-closures/unboxed-closures-prelude.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/ui/unboxed-closures/unboxed-closures-prelude.rs b/tests/ui/unboxed-closures/unboxed-closures-prelude.rs new file mode 100644 index 000000000..89a273b7a --- /dev/null +++ b/tests/ui/unboxed-closures/unboxed-closures-prelude.rs @@ -0,0 +1,18 @@ +// run-pass +// Tests that the re-exports of `FnOnce` et al from the prelude work. + +// pretty-expanded FIXME #23616 + +fn main() { + let task: Box<dyn Fn(isize) -> isize> = Box::new(|x| x); + task(0); + + let mut task: Box<dyn FnMut(isize) -> isize> = Box::new(|x| x); + task(0); + + call(|x| x, 22); +} + +fn call<F:FnOnce(isize) -> isize>(f: F, x: isize) -> isize { + f(x) +} |