Skip to content

Use the correct span for displaying the line following a derive sugge… #113871

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 20, 2023

Conversation

clubby789
Copy link
Contributor

span here is the main span of the diagnostic. In the linked issue's case, this belongs to main.rs. However, the line numbers (and line we are trying to display) are in name.rs, so using span_to_lines gives us the wrong FileLines.

Use parts[0].span (the span of the suggestion) here like the rest of the code does to get the right file.

Not sure if this needs a dedicated test because this fixes an existing error in the UI suite

Fixes #113844

@rustbot
Copy link
Collaborator

rustbot commented Jul 19, 2023

r? @eholk

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 19, 2023
@compiler-errors
Copy link
Member

r? @compiler-errors @bors r+ rollup

@bors
Copy link
Collaborator

bors commented Jul 20, 2023

📌 Commit 20a3b9a has been approved by compiler-errors

It is now in the queue for this repository.

@rustbot rustbot assigned compiler-errors and unassigned eholk Jul 20, 2023
@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 20, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 20, 2023
…iaskrgr

Rollup of 5 pull requests

Successful merges:

 - rust-lang#113710 (Fix rpath for libdir is specified)
 - rust-lang#113787 (Update documentation for std::process::Command's new method)
 - rust-lang#113795 (Properly document `lifetime_mapping` in `OpaqueTy`)
 - rust-lang#113857 (Add tests for `--document-hidden-items` option)
 - rust-lang#113871 (Use the correct span for displaying the line following a derive sugge…)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 770c8d0 into rust-lang:master Jul 20, 2023
@rustbot rustbot added this to the 1.73.0 milestone Jul 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Help message in E0369 points to wrong file
5 participants