Files
rust/tests/ui/unboxed-closures/unboxed-closures-prelude.rs
许杰友 Jieyou Xu (Joe) 95ff642797 tests: remove //@ pretty-expanded usages
Done with

```bash
sd '//@ pretty-expanded.*\n' '' tests/ui/**/*.rs
```

and

```
sd '//@pretty-expanded.*\n' '' tests/ui/**/*.rs
```
2024-11-26 02:50:48 +08:00

18 lines
350 B
Rust

//@ run-pass
// Tests that the re-exports of `FnOnce` et al from the prelude work.
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)
}