diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
commit | 218caa410aa38c29984be31a5229b9fa717560ee (patch) | |
tree | c54bd55eeb6e4c508940a30e94c0032fbd45d677 /src/test/ui/unboxed-closures/unboxed-closures-extern-fn-hr.rs | |
parent | Releasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip |
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/unboxed-closures/unboxed-closures-extern-fn-hr.rs')
-rw-r--r-- | src/test/ui/unboxed-closures/unboxed-closures-extern-fn-hr.rs | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-extern-fn-hr.rs b/src/test/ui/unboxed-closures/unboxed-closures-extern-fn-hr.rs deleted file mode 100644 index 3ee1aeb10..000000000 --- a/src/test/ui/unboxed-closures/unboxed-closures-extern-fn-hr.rs +++ /dev/null @@ -1,31 +0,0 @@ -// run-pass -// Checks that higher-ranked extern fn pointers implement the full range of Fn traits. - -fn square(x: &isize) -> isize { (*x) * (*x) } - -fn call_it<F:Fn(&isize)->isize>(f: &F, x: isize) -> isize { - (*f)(&x) -} - -fn call_it_boxed(f: &dyn Fn(&isize) -> isize, x: isize) -> isize { - f(&x) -} - -fn call_it_mut<F:FnMut(&isize)->isize>(f: &mut F, x: isize) -> isize { - (*f)(&x) -} - -fn call_it_once<F:FnOnce(&isize)->isize>(f: F, x: isize) -> isize { - f(&x) -} - -fn main() { - let x = call_it(&square, 22); - let x1 = call_it_boxed(&square, 22); - let y = call_it_mut(&mut square, 22); - let z = call_it_once(square, 22); - assert_eq!(x, square(&22)); - assert_eq!(x1, square(&22)); - assert_eq!(y, square(&22)); - assert_eq!(z, square(&22)); -} |