mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 15:23:46 +00:00
1e22280f23
- 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`
17 lines
577 B
Plaintext
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`.
|