Calling trait function declared with both explicit generics and impl Trait gives confusing errors #94836
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Given the following code:
I had a trait that was originally defined like this:
T
is a type parameter that is used to pass a function pointer into implementations of this trait.Users of this API call it like this:
I was trying to remove the
P
type parameter to allow for a bit nicer of a turbofish without the anonymous placeholder so I redefined the trait to look like:I attempted to compile this before refactoring callers.
Full program below.
Playground link: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=49b4d1c31975f80c7cc2f3c1f8a06933
The current output is:
Ideally the output should look like:
There are two errors here:
The text was updated successfully, but these errors were encountered: