blob: 6851dcdd504d19c1617b16b8acc03becf3782692 [file] [log] [blame]
kadmin2de9d672023-01-10 06:08:181error[E0277]: the trait bound `fn() -> bool {example}: Foo` is not satisfied
2 --> $DIR/fn-trait-cast-diagnostic.rs:21:15
3 |
4LL | do_on_foo(example);
5 | --------- ^^^^^^^ the trait `Foo` is not implemented for fn item `fn() -> bool {example}`
6 | |
7 | required by a bound introduced by this call
8 |
9note: required by a bound in `do_on_foo`
10 --> $DIR/fn-trait-cast-diagnostic.rs:17:22
11 |
12LL | fn do_on_foo(v: impl Foo) {}
13 | ^^^ required by this bound in `do_on_foo`
14help: use parentheses to call this function
15 |
16LL | do_on_foo(example());
17 | ++
18help: the trait `Foo` is implemented for fn pointer `fn() -> bool`, try casting using `as`
19 |
20LL | do_on_foo(example as fn() -> bool);
21 | +++++++++++++++
22
23error[E0277]: the trait bound `fn() -> bool {example}: NoOtherFoo` is not satisfied
24 --> $DIR/fn-trait-cast-diagnostic.rs:24:22
25 |
26LL | do_on_single_foo(example);
27 | ---------------- ^^^^^^^ the trait `NoOtherFoo` is not implemented for fn item `fn() -> bool {example}`
28 | |
29 | required by a bound introduced by this call
30 |
31note: required by a bound in `do_on_single_foo`
32 --> $DIR/fn-trait-cast-diagnostic.rs:18:29
33 |
34LL | fn do_on_single_foo(v: impl NoOtherFoo) {}
35 | ^^^^^^^^^^ required by this bound in `do_on_single_foo`
36help: the trait `NoOtherFoo` is implemented for fn pointer `fn() -> bool`, try casting using `as`
37 |
38LL | do_on_single_foo(example as fn() -> bool);
39 | +++++++++++++++
40
41error: aborting due to 2 previous errors
42
43For more information about this error, try `rustc --explain E0277`.