Bad diagnostic output for Fn
traits with E0277
#95147
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
D-newcomer-roadblock
Diagnostics: Confusing error or lint; hard to understand for new users.
D-papercut
Diagnostics: An error or lint that needs small tweaks.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Given the following code:
(playground)
The current output is:
Ideally the output should look like:
Frankly it would be nice if we could improve the "further restricting this bound" to be something different (as restricting the bound is impossible in this case--something can't be both
FnMut(i32)
andFnOnce(&i32)
), but we should at least render theFnOnce
trait syntax right.rustc --version --verbose
:I cannot seem to find any place to start a bisection, so as far as I can tell this behaviour has always been present.
This code is an MCVE of the following less contrived case (using a bit of truncated code, as the exact details of the implementation of this lexer-like structure are not too important), found by @slavfox:
I tested this and it does not seem like the
~const
ness of the trait bounds ofOption::filter
affect the overall diagnostic rendering.I may try to fix this in a PR if I can find out why it is occurring.
@rustbot label: +D-newcomer-roadblock +D-papercut
The text was updated successfully, but these errors were encountered: