Skip to content

Regression in spacing of left margin in diagnostics #71363

@dtolnay

Description

@dtolnay
struct MyError;
impl std::error::Error for MyError {}
$ cargo +nightly-2020-04-19 check
error[E0277]: `MyError` doesn't implement `std::fmt::Display`
 --> src/main.rs:2:6
  |
2 | impl std::error::Error for MyError {}
  |      ^^^^^^^^^^^^^^^^^ `MyError` cannot be formatted with the default formatter
  |
  = help: the trait `std::fmt::Display` is not implemented for `MyError`
  = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead

$ cargo +nightly-2020-04-20 check
error[E0277]: `MyError` doesn't implement `std::fmt::Display`
  --> src/main.rs:2:6
   |
2  | impl std::error::Error for MyError {}
   |      ^^^^^^^^^^^^^^^^^ `MyError` cannot be formatted with the default formatter
   |
   = help: the trait `std::fmt::Display` is not implemented for `MyError`
   = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead

Notice the extra one column of indentation in front of the pipes. I presume this is unintentional because almost any other error is still printed without such extra indentation; for example:

error: expected one of `!`, `(`, `+`, `::`, `<`, `where`, or `{`, found `;`
 --> src/main.rs:2:35
  |
2 | impl std::error::Error for MyError;
  |                                   ^ expected one of 7 possible tokens

The relevant commit range is 52fa23a...dbf8b6b.
Mentioning @estebank @eddyb because #69745 looks like it touches error messages vaguely along the same lines.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.ICEBreaker-Cleanup-CrewHelping to "clean up" bugs with minimal examples and bisectionsP-lowLow priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions