Repository navigation
Point E0117 at the self type to avoid overlapping spans - #164605
VibhuGupta-dev wants to merge 1 commit into
Conversation
|
Thanks for the pull request, and welcome! The Rust Project has assigned @beetrees (or someone else) to review your changes, you should hear from them (or someone else) within the next two weeks. Please see the contribution instructions and our LLM policy for more information. Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
|
The code change looks good to me, thanks for writing this! |
b7bf455 to
5f70091
Compare
|
Thanks for the review! You were right, I had missed re-blessing some UI tests outside
The diff in these files is only the changed primary span (it now points at the self type instead of the whole impl header). There are no other changes. I also ran I amended and force-pushed, so the PR is still a single commit. |
|
The job Click to see the possible cause of the failure (guessed by this bot) |
|
For the future, please avoid generating PR descriptions and comments with LLMs. Even if you write part of them yourself, there is no benefit to us to include the verbose things like which commands you ran and which tests you modified. All of that is visible to us in the diff, so this should be just information the LLM gives to you, but you should only write messages to us including things actually relevant to us. That said: please read our LLM policy on how to contribute to this project in general. |
considering the new error that occurred in CI, did you actually run that command? |
Fixes #164592
E0117 used the whole impl header (
tcx.def_span(impl_def_id)) as itsprimary span, while the labels point at the trait path and the self type,
both of which sit inside that header. These overlapping spans render as a
chopped-up underline in the terminal (
^^^^^---------^^^^^--------) andas fragmented ranges in LSP.
This PR uses the self type span (
impl_.self_ty.span) as the primary spanin
emit_orphan_check_error, so the trait label and the primary span nolonger overlap. Only diagnostic output changes; there are no logic changes.
Before:
After:
When the primary span and the label point at the same type (for example
impl Copy for i32 {}), they now coincide and are rendered as a singleunderline with the label attached.
Notes for reviewers:
.stderrfiles for E0117 undertests/ui/coherence/(and afew others) are re-blessed. The diff there is only the changed spans.
touched.
tests/ui/coherence/orphan-foreign-trait-box.rsas a regression testfor the case from the issue.
i32onBox<i32>) is unchanged and out of scope here.