Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

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

Closed
matthiaskrgr opened this issue Apr 19, 2023 · 0 comments · Fixed by #111463
Closed

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

matthiaskrgr opened this issue Apr 19, 2023 · 0 comments · Fixed by #111463
Labels
A-diagnostics Area: Messages for errors, warnings, and lints D-papercut Diagnostics: An error or lint that needs small tweaks. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

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

@matthiaskrgr matthiaskrgr 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. labels Apr 19, 2023
@jyn514 jyn514 added the D-papercut Diagnostics: An error or lint that needs small tweaks. label Apr 20, 2023
@bors bors closed this as completed in 0b8f2bf May 14, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints D-papercut Diagnostics: An error or lint that needs small tweaks. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants