fork/rust

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

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

master
1.3 KiB48 linesraw
1error: expected identifier, found keyword `fn`
2  --> $DIR/recover-fn-trait-from-fn-kw.rs:1:16
3   |
4LL | fn foo(_: impl fn() -> i32) {}
5   |                ^^
6   |
7help: use `Fn` to refer to the trait
8   |
9LL | fn foo(_: impl Fn() -> i32) {}
10   |                ~~
11
12error: expected identifier, found keyword `fn`
13  --> $DIR/recover-fn-trait-from-fn-kw.rs:4:12
14   |
15LL | fn foo2<T: fn(i32)>(_: T) {}
16   |            ^^
17   |
18help: use `Fn` to refer to the trait
19   |
20LL | fn foo2<T: Fn(i32)>(_: T) {}
21   |            ~~
22
23error[E0308]: mismatched types
24  --> $DIR/recover-fn-trait-from-fn-kw.rs:8:12
25   |
26LL |     foo(|| ());
27   |            ^^ expected `i32`, found `()`
28
29error[E0631]: type mismatch in closure arguments
30  --> $DIR/recover-fn-trait-from-fn-kw.rs:10:5
31   |
32LL |     foo2(|_: ()| {});
33   |     ^^^^ ------- found signature defined here
34   |     |
35   |     expected due to this
36   |
37   = note: expected closure signature `fn(i32) -> _`
38              found closure signature `fn(()) -> _`
39note: required by a bound in `foo2`
40  --> $DIR/recover-fn-trait-from-fn-kw.rs:4:12
41   |
42LL | fn foo2<T: fn(i32)>(_: T) {}
43   |            ^^^^^^^ required by this bound in `foo2`
44
45error: aborting due to 4 previous errors
46
47Some errors have detailed explanations: E0308, E0631.
48For more information about an error, try `rustc --explain E0308`.