-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Regression in spacing of left margin in diagnostics #65001
Comments
Mentioning @AnthonyMikh @estebank who made changes in librustc_errors. Could this be from #64935? |
It looks like this can cause the wrong line number to be printed. :( If you bump the problematic line down to line 100, it prints as 10: error[E0308]: mismatched types
--> src/main.rs:100:17
|
10| let _: () = A;
| ^ expected (), found struct `A`
|
= note: expected type `()`
found type `A` |
It seems like it might be. |
Indeed. Upon closer inspection I've found out that 7b4c5c6 actually changes the semantics of method: after applying this commit, if The correct code should rather look like this: fn get_max_line_num(&mut self, span: &MultiSpan, children: &[SubDiagnostic]) -> usize {
let primary = self.get_multispan_max_line_num(span);
children.iter()
.map(|sub| self.get_multispan_max_line_num(&sub.span))
.max()
.unwrap_or(0)
.max(primary)
} Although it might be not the bug responsible for this issue, it definetely should be fixed. I'll make a PR with fix ASAP. EDIT: Here it is |
Subtle. That seems about right. |
|
Compare `primary` with maximum of `children`s' line num instead of dropping it Fix rust-lang#65001.
Compare `primary` with maximum of `children`s' line num instead of dropping it Fix rust-lang#65001.
$ cargo +nightly-2019-10-01 check
This is the correct output.
$ cargo +nightly-2019-10-02 check
Notice that one of the errors has a column of whitespace between the line number and the pipes, the next does not.
Commit range: 22bc9e1...702b45e
The text was updated successfully, but these errors were encountered: