Skip to content

Diagnostic suggestions highlighting can become misaligned #104150

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

Closed
Alexendoo opened this issue Nov 8, 2022 · 4 comments
Closed

Diagnostic suggestions highlighting can become misaligned #104150

Alexendoo opened this issue Nov 8, 2022 · 4 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix` C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Alexendoo
Copy link
Member

Alexendoo commented Nov 8, 2022

Given a cargo +nightly clippy on the following:

#[derive(Copy, Clone)]
struct Foo(bool);

impl Into<(Foo, Foo)> for Foo {
    fn into(self) -> (Foo, Foo) {
        (self, self)
    }
}

fn main() {}

The current output is:

image

In line 6, (val, val) the second highlight is misaligned, it's highlighted at (val, v~al)~

@Alexendoo Alexendoo added 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. C-bug Category: This is a bug. A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix` labels Nov 8, 2022
@Alexendoo Alexendoo changed the title Diagnostic suggestions highlight can become misaligned Diagnostic suggestions highlighting can become misaligned Nov 8, 2022
@NotStirred
Copy link
Contributor

@rustbot claim

@NotStirred
Copy link
Contributor

@rustbot release-assignment

Releasing as I am unable to test my changes to the compiler with clippy, perhaps due to #81431
If anyone can provide any guidance I'd be grateful

I believe the issue is in rustc_errors::CodeSuggestion::splice_lines, but can't verify without testing

@NotStirred
Copy link
Contributor

This appears to be fixed on latest master
image
Though I am unsure of which commit fixed it

@Alexendoo
Copy link
Member Author

Nice, looks like it was fixed by #108627

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix` C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants