rust/tests/ui/static/static-reference-to-fn-1.stderr
Matthew J Perez 1e22280f23
Add suggestions for function pointers
- On compiler-error's suggestion of moving this lower down the stack,
along the path of `report_mismatched_types()`, which is used
by `rustc_hir_analysis` and `rustc_hir_typeck`.
- update ui tests, add test
- add suggestions for references to fn pointers
- modify `TypeErrCtxt::same_type_modulo_infer` to take `T: relate::Relate` instead of `Ty`
2023-01-24 14:02:56 -05:00

17 lines
577 B
Plaintext

error[E0308]: mismatched types
--> $DIR/static-reference-to-fn-1.rs:17:15
|
LL | func: &foo,
| ^^^^
| |
| expected fn pointer, found fn item
| help: consider casting to a fn pointer: `&(foo as fn() -> Option<isize>)`
|
= note: expected reference `&fn() -> Option<isize>`
found reference `&fn() -> Option<isize> {foo}`
= note: fn items are distinct from fn pointers
error: aborting due to previous error
For more information about this error, try `rustc --explain E0308`.