Skip to content
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

Normalize use of backticks in syntax for user-facing compiler messages #60532

Closed
alexreg opened this issue May 4, 2019 · 11 comments
Closed

Normalize use of backticks in syntax for user-facing compiler messages #60532

alexreg opened this issue May 4, 2019 · 11 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-enhancement Category: An issue proposing an enhancement or a PR with one. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@alexreg
Copy link
Contributor

alexreg commented May 4, 2019

This is more pedantry from me, and admittedly not very high-priority, but I have noticed that there are discrepancies between compiler error/informational messages where syntax is included in them – some use backticks around code syntax, some don't. Furthermore, some start with lower case (the vast majority), while some don't.

For example:

"attribute must be of the form `#[derive(Trait1, Trait2, ...)]`"

vs.

"type does not implement `fmt::Debug`; consider adding #[derive(Debug)] \

(an internal inconsistency in this second case too!)

It would be nice to normalise this according some guidelines. I'd imagine the guidelines should agree with rustdoc as much as possible, though starting all messages with lower case may be desirable, since it is "command-line fashion".

@jonas-schievink jonas-schievink added A-diagnostics Area: Messages for errors, warnings, and lints C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 4, 2019
@varkor varkor added the E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. label May 4, 2019
@fakenine
Copy link
Contributor

Hello, I would like to work on this one! cc @varkor

@varkor
Copy link
Member

varkor commented May 23, 2019

@fakenine: I'm not sure of a principled way to go about this, but you can look in the compiler for error messages (coming from span_err and similar functions) and update any that have code in them to be surrounded by backticks. Running x.py test src/test/ui --bless then should update all the test files.

@alexreg
Copy link
Contributor Author

alexreg commented May 23, 2019

Thanks @fakenine, sounds good.

@alexreg
Copy link
Contributor Author

alexreg commented May 23, 2019

Unfortunately a lot of this will have to be done manually as @varkor hints at, but a good deal can be automated by searching with regexps, e.g. ".*[^`]#\[\w+ will find lines including a string terminator followed (eventually) by an attribute, where the attribute is not preceded by a backtick. You can probably make a shortlist of similar patterns and then create regexps for them.

@fakenine
Copy link
Contributor

Thanks for the tips, I will look into that!

@alexreg
Copy link
Contributor Author

alexreg commented Jun 11, 2019

Hi @fakenine. Any news on this so far? Let me know if you need advice or an initial cursory review!

@fakenine
Copy link
Contributor

Hi @alexreg ! Thanks for the help. I was on holidays so I didn't get the time to start properly looking on it. I should be able to start this weekend

@alexreg
Copy link
Contributor Author

alexreg commented Jun 11, 2019

No problem. Keep us posted, and feel free to ask here or on Discord. :-)

@fakenine
Copy link
Contributor

Hello @alexreg! I have opened a WIP PR here #61901

There are indeed lots of changes to do manually and results to sort with the regexes, but I'm confident about it :)

Centril added a commit to Centril/rust that referenced this issue Jul 6, 2019
…_compiler_messages_1, r=Centril

normalize use of backticks/lowercase in compiler messages for librustc_mir

normalize use of backticks/lowercase in compiler messages for librustc_mir

rust-lang#60532

r? @alexreg
Centril added a commit to Centril/rust that referenced this issue Jul 6, 2019
…_compiler_messages_1, r=Centril

normalize use of backticks/lowercase in compiler messages for librustc_mir

normalize use of backticks/lowercase in compiler messages for librustc_mir

rust-lang#60532

r? @alexreg
Centril added a commit to Centril/rust that referenced this issue Jul 6, 2019
…_compiler_messages_1, r=Centril

normalize use of backticks/lowercase in compiler messages for librustc_mir

normalize use of backticks/lowercase in compiler messages for librustc_mir

rust-lang#60532

r? @alexreg
Centril added a commit to Centril/rust that referenced this issue Jul 6, 2019
…_compiler_messages_1, r=Centril

normalize use of backticks/lowercase in compiler messages for librustc_mir

normalize use of backticks/lowercase in compiler messages for librustc_mir

rust-lang#60532

r? @alexreg
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this issue Jul 23, 2019
…_compiler_messages_p14, r=Centril

normalize use of backticks in compiler messages for librustc_allocator

rust-lang#60532
fakenine pushed a commit to fakenine/rust that referenced this issue Jul 23, 2019
bors added a commit that referenced this issue Jul 23, 2019
…essages_p17, r=alexreg

normalize use of backticks for compiler messages in remaining modules

#60532
Centril added a commit to Centril/rust that referenced this issue Jul 23, 2019
…_compiler_messages_p15, r=Centril

Normalize use of backticks in compiler messages for libsyntax/*

rust-lang#60532
Centril added a commit to Centril/rust that referenced this issue Jul 23, 2019
…_compiler_messages_p16, r=Centril

Normalize use of backticks in compiler messages for doc

rust-lang#60532
Centril added a commit to Centril/rust that referenced this issue Jul 23, 2019
…_compiler_messages_p17, r=alexreg

normalize use of backticks for compiler messages in remaining modules

rust-lang#60532
Centril added a commit to Centril/rust that referenced this issue Jul 24, 2019
…_compiler_messages_p15, r=Centril

Normalize use of backticks in compiler messages for libsyntax/*

rust-lang#60532
Centril added a commit to Centril/rust that referenced this issue Jul 24, 2019
…_compiler_messages_p16, r=Centril

Normalize use of backticks in compiler messages for doc

rust-lang#60532
Centril added a commit to Centril/rust that referenced this issue Jul 24, 2019
…_compiler_messages_p17, r=alexreg

normalize use of backticks for compiler messages in remaining modules

rust-lang#60532
bors added a commit that referenced this issue Jul 24, 2019
…essages_p17, r=alexreg

normalize use of backticks for compiler messages in remaining modules

#60532
Centril added a commit to Centril/rust that referenced this issue Jul 24, 2019
…_compiler_messages_p15, r=Centril

Normalize use of backticks in compiler messages for libsyntax/*

rust-lang#60532
Centril added a commit to Centril/rust that referenced this issue Jul 24, 2019
…_compiler_messages_p16, r=Centril

Normalize use of backticks in compiler messages for doc

rust-lang#60532
@fakenine
Copy link
Contributor

I think this can be marked as resolved now 🎉

@alexreg
Copy link
Contributor Author

alexreg commented Jul 26, 2019

Yep!

@alexreg alexreg closed this as completed Jul 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-enhancement Category: An issue proposing an enhancement or a PR with one. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. 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.

4 participants