fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
2.6 KiB51 linesraw
1error[E0277]: expected a `Fn<(&isize,)>` closure, found `for<'a> unsafe fn(&'a isize) -> isize {square}`
2  --> $DIR/unboxed-closures-unsafe-extern-fn.rs:20:21
3   |
4LL |     let x = call_it(&square, 22);
5   |             ------- ^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
6   |             |
7   |             required by a bound introduced by this call
8   |
9   = help: the trait `for<'a> Fn<(&'a isize,)>` is not implemented for fn item `for<'a> unsafe fn(&'a isize) -> isize {square}`
10   = note: unsafe function cannot be called generically without an unsafe block
11note: required by a bound in `call_it`
12  --> $DIR/unboxed-closures-unsafe-extern-fn.rs:9:15
13   |
14LL | fn call_it<F: Fn(&isize) -> isize>(_: &F, _: isize) -> isize {
15   |               ^^^^^^^^^^^^^^^^^^^ required by this bound in `call_it`
16
17error[E0277]: expected a `FnMut<(&isize,)>` closure, found `for<'a> unsafe fn(&'a isize) -> isize {square}`
18  --> $DIR/unboxed-closures-unsafe-extern-fn.rs:25:25
19   |
20LL |     let y = call_it_mut(&mut square, 22);
21   |             ----------- ^^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
22   |             |
23   |             required by a bound introduced by this call
24   |
25   = help: the trait `for<'a> FnMut<(&'a isize,)>` is not implemented for fn item `for<'a> unsafe fn(&'a isize) -> isize {square}`
26   = note: unsafe function cannot be called generically without an unsafe block
27note: required by a bound in `call_it_mut`
28  --> $DIR/unboxed-closures-unsafe-extern-fn.rs:12:19
29   |
30LL | fn call_it_mut<F: FnMut(&isize) -> isize>(_: &mut F, _: isize) -> isize {
31   |                   ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `call_it_mut`
32
33error[E0277]: expected a `FnOnce<(&isize,)>` closure, found `for<'a> unsafe fn(&'a isize) -> isize {square}`
34  --> $DIR/unboxed-closures-unsafe-extern-fn.rs:30:26
35   |
36LL |     let z = call_it_once(square, 22);
37   |             ------------ ^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
38   |             |
39   |             required by a bound introduced by this call
40   |
41   = help: the trait `for<'a> FnOnce<(&'a isize,)>` is not implemented for fn item `for<'a> unsafe fn(&'a isize) -> isize {square}`
42   = note: unsafe function cannot be called generically without an unsafe block
43note: required by a bound in `call_it_once`
44  --> $DIR/unboxed-closures-unsafe-extern-fn.rs:15:20
45   |
46LL | fn call_it_once<F: FnOnce(&isize) -> isize>(_: F, _: isize) -> isize {
47   |                    ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `call_it_once`
48
49error: aborting due to 3 previous errors
50
51For more information about this error, try `rustc --explain E0277`.