about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/errors.rs
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-01-14 13:04:25 +0100
committerGitHub <noreply@github.com>2023-01-14 13:04:25 +0100
commit3fa9be9094e5412afeea05ce5ed821700809d0d2 (patch)
tree84e220b35aaef011a21d0ee92400a789709662ac /compiler/rustc_parse/src/errors.rs
parentbc4049d8615419658d7bbfb4401b9d5d6c7ff655 (diff)
parent2de9d679adcc2740f490e8f702b2d227be2de30a (diff)
downloadrust-3fa9be9094e5412afeea05ce5ed821700809d0d2.tar.gz
rust-3fa9be9094e5412afeea05ce5ed821700809d0d2.zip
Rollup merge of #106665 - JulianKnodt:better_fn_trait_note, r=cjgillot
Add note when `FnPtr` vs. `FnDef` impl trait

I encountered an instance where an `FnPtr` implemented a trait, but I was passing an `FnDef`. I was confused for an hour and to examine the source code of the trait's crate's tests in order to understand how to cast it properly (it didn't help that it was behind a reference). To the end user, it might not be immediately obvious that they are different and how to convert from an `FnDef` to an `FnPtr`, but it is necessary to cast to the generic function in order to compile. It is thus useful to suggest `as` in the help note, (even if the `Fn` output implements the trait).
Diffstat (limited to 'compiler/rustc_parse/src/errors.rs')
0 files changed, 0 insertions, 0 deletions