Add bullet points for error messages and use them in query cycle errors#154528
Add bullet points for error messages and use them in query cycle errors#154528Zoxc wants to merge 1 commit intorust-lang:mainfrom
Conversation
|
Before: After: |
|
cc @rust-lang/wg-diagnostics The implementation is LLM written, so it probably needs some cleanup if this is deemed a positive change. |
This comment has been minimized.
This comment has been minimized.
|
The job Click to see the possible cause of the failure (guessed by this bot) |
|
|
||
| fn format_message_for_level(level: Level, msg: Cow<'static, str>) -> Cow<'static, str> { | ||
| match level { | ||
| Level::BulletPoint => Cow::Owned(format!(" - {msg}")), |
There was a problem hiding this comment.
Will this work correctly to align the "bullet point" regardless of gutter width? In the test suite we normalize the output to LL |, but can you manually test a case where LL is single or triple digit? I highly suspect this is not correct.
| ForceWarning | Warning | Note | OnceNote | Help | OnceHelp | FailureNote | Allow | ||
| | Expect => None, | ||
| ForceWarning | Warning | Note | BulletPoint | OnceNote | Help | OnceHelp | ||
| | FailureNote | Allow | Expect => None, |
There was a problem hiding this comment.
Would have been nice to add BulletPoint to the end of the or-pattern to make the diff faster to skim :)
| | ^^^^^^^^^^^ | ||
| | | ||
| note: ...which requires const-evaluating + checking `Tr::A`... | ||
| - which requires const-evaluating + checking `Tr::A`... |
There was a problem hiding this comment.
I'm intrigued how this will render under human-unicode or annotate-snippets equivalent. (Need to do a proper review of the main logic still.)
|
I am trying to think of alternative ways of rendering this. I see where you're going with it, and it might be worth it. CC @Muscraft for thoughts, as annotate-snippets sees wider range of use-cases than rustc and might have clearer thoughts on this. |
|
What's the motivation for this? It doesn't seem to substantially changed readability to me personally , and without information about non-expert users encountering cycle errors it seems like just a stylistic choice without the status quo or your change being better |
|
☔ The latest upstream changes (presumably #154727) made this pull request unmergeable. Please resolve the merge conflicts. |
This adds bullet points to diagnostics which always prints with even indentation.
Query cycle errors are changed to make use of them. The
...prefix on the query cycle errors is also removed.