Less accurate span is used when projection occurs in associated type position #83794
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
C-bug
Category: This is a bug.
D-inconsistent
Diagnostics: Inconsistency in formatting, grammar or style between diagnostic messages.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
The following code:
produces the following error:
Note that the span points directly at
<u8 as MyTrait>::Item
However, if the same projection
<u8 as MyTrait>::Item
is used in associated type position:produces this error:
Here, the span points to the entire associated type, instead of just the projection.
This can lead to unhelpful errors in macro-generated code, since the span of the associated type may be completely different from the span of the projection.
The text was updated successfully, but these errors were encountered: