Skip to content

diagnostics look weird when rustc is trying to quote whitespace characters #110559

Closed
@matthiaskrgr

Description

@matthiaskrgr

Code

env!{"\t"}

Current output

error: environment variable `    ` not defined at compile time
 --> env.rs:1:1
  |
1 | env!{"\t"}
  | ^^^^^^^^^^
  |
  = help: use `std::env::var("	")` to read the variable at run time
  = note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info)

Desired output

This error: environment variable `    ` not defined at compile time

looks very weird imo because it looks like its something misssing there. I think actually rustc is quoting the `\t` here but while it is escaped in the code, it is not escaped in the error message.
Might be nice to print something like
..`    `(`\t`) not defined.. ?

Rationale and extra context

No response

Other cases

No response

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsD-papercutDiagnostics: An error or lint that needs small tweaks.T-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