Skip to content

E0277 unfortunate spacing in source  #107649

Closed
@matthiaskrgr

Description

@matthiaskrgr

Code

rustc code I was messing around with

Current output

error[E0277]: `UnusedDelimSuggestion` doesn't implement `std::fmt::Debug`
   --> /home/matthias/vcs/github/rust/library/std/src/macros.rs:354:81
    |
204 |   macro_rules! eprintln {
    |   --------------------- in this expansion of `$crate::eprintln!` (#2)
...
209 |           $crate::io::_eprint($crate::format_args_nl!($($arg)*));
    |                               --------------------------------- in this macro invocation (#3)
...
340 |   macro_rules! dbg {
    |   ---------------- in this expansion of `dbg!` (#1)
...
353 | /                 $crate::eprintln!("[{}:{}] {} = {:#?}",
354 | |                     $crate::file!(), $crate::line!(), $crate::stringify!($val), &tmp);
    | |_________________________________________________________________________________^^^^- in this macro invocation (#2)
    |                                                                                   |
    |                                                                                   `UnusedDelimSuggestion` cannot be formatted using `{:?}`
    |
   ::: compiler/rustc_lint/src/unused.rs:695:9
    |
695 |           dbg!(suggestion);
    |           ---------------- in this macro invocation (#1)
    |
   ::: /home/matthias/vcs/github/rust/library/core/src/macros/mod.rs:906:5
    |
906 |       macro_rules! format_args_nl {
    |       --------------------------- in this expansion of `$crate::format_args_nl!` (#3)
    |
    = help: the trait `std::fmt::Debug` is not implemented for `UnusedDelimSuggestion`
    = note: add `#[derive(Debug)]` to `UnusedDelimSuggestion` or manually `impl std::fmt::Debug for UnusedDelimSuggestion`
    = help: the trait `std::fmt::Debug` is implemented for `Option<T>`
help: consider annotating `UnusedDelimSuggestion` with `#[derive(Debug)]`
   --> |compiler/rustc_lint/src/lints.rs:1465:1
    |
1465| #[derive(Debug)]
    |

Desired output

for the `help:` suggestion, 
`   --> |compiler/rustc_lint/src/lints.rs:1465:1` will include the leading pipe when clicking on it.
Should be
`   --> | compiler/rustc_lint/src/lints.rs:1465:1`

Rationale and extra context

No response

Other cases

No response

Anything else?

No response

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions