-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Add bullet points for error messages and use them in query cycle errors #154528
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -600,8 +600,8 @@ impl<'a> DiagCtxtHandle<'a> { | |
| DelayedBug => { | ||
| return self.inner.borrow_mut().emit_diagnostic(diag, self.tainted_with_errors); | ||
| } | ||
| ForceWarning | Warning | Note | OnceNote | Help | OnceHelp | FailureNote | Allow | ||
| | Expect => None, | ||
| ForceWarning | Warning | Note | BulletPoint | OnceNote | Help | OnceHelp | ||
| | FailureNote | Allow | Expect => None, | ||
|
Comment on lines
-603
to
+604
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would have been nice to add |
||
| }; | ||
|
|
||
| // FIXME(Centril, #69537): Consider reintroducing panic on overwriting a stashed diagnostic | ||
|
|
@@ -1261,7 +1261,7 @@ impl DiagCtxtInner { | |
| return None; | ||
| } | ||
| } | ||
| Note | Help | FailureNote => {} | ||
| Note | BulletPoint | Help | FailureNote => {} | ||
| OnceNote | OnceHelp => panic!("bad level: {:?}", diagnostic.level), | ||
| Allow => { | ||
| // Nothing emitted for allowed lints. | ||
|
|
@@ -1531,6 +1531,7 @@ impl DelayedDiagInner { | |
| /// | ForceWarning | - | () | yes | - | lint-only | ||
| /// | Warning | - | () | yes | yes | yes | ||
| /// | Note | - | () | rare | yes | - | ||
| /// | BulletPoint | - | () | - | yes | - | ||
| /// | OnceNote | - | () | - | yes | lint-only | ||
| /// | Help | - | () | rare | yes | - | ||
| /// | OnceHelp | - | () | - | yes | lint-only | ||
|
|
@@ -1574,6 +1575,9 @@ pub enum Level { | |
| /// A message giving additional context. | ||
| Note, | ||
|
|
||
| /// A message rendered as a bullet point. | ||
| BulletPoint, | ||
|
|
||
| /// A note that is only emitted once. | ||
| OnceNote, | ||
|
|
||
|
|
@@ -1611,7 +1615,7 @@ impl Level { | |
| AnsiColor::Yellow.on_default() | ||
| } | ||
| } | ||
| Note | OnceNote => AnsiColor::BrightGreen.on_default(), | ||
| Note | BulletPoint | OnceNote => AnsiColor::BrightGreen.on_default(), | ||
| Help | OnceHelp => AnsiColor::BrightCyan.on_default(), | ||
| FailureNote => anstyle::Style::new(), | ||
| Allow | Expect => unreachable!(), | ||
|
|
@@ -1624,6 +1628,7 @@ impl Level { | |
| Fatal | Error => "error", | ||
| ForceWarning | Warning => "warning", | ||
| Note | OnceNote => "note", | ||
| BulletPoint => "bullet-point", | ||
| Help | OnceHelp => "help", | ||
| FailureNote => "failure-note", | ||
| Allow | Expect => unreachable!(), | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,22 +4,22 @@ error[E0391]: cycle detected when simplifying constant for the type system `Tr:: | |
| LL | const A: u8 = Self::B; | ||
| | ^^^^^^^^^^^ | ||
| | | ||
| note: ...which requires const-evaluating + checking `Tr::A`... | ||
| - which requires const-evaluating + checking `Tr::A`... | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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.) |
||
| --> $DIR/defaults-cyclic-fail.rs:5:19 | ||
| | | ||
| LL | const A: u8 = Self::B; | ||
| | ^^^^^^^ | ||
| note: ...which requires simplifying constant for the type system `Tr::B`... | ||
| - which requires simplifying constant for the type system `Tr::B`... | ||
| --> $DIR/defaults-cyclic-fail.rs:8:5 | ||
| | | ||
| LL | const B: u8 = Self::A; | ||
| | ^^^^^^^^^^^ | ||
| note: ...which requires const-evaluating + checking `Tr::B`... | ||
| - which requires const-evaluating + checking `Tr::B`... | ||
| --> $DIR/defaults-cyclic-fail.rs:8:19 | ||
| | | ||
| LL | const B: u8 = Self::A; | ||
| | ^^^^^^^ | ||
| = note: ...which again requires simplifying constant for the type system `Tr::A`, completing the cycle | ||
| - which again requires simplifying constant for the type system `Tr::A`, completing the cycle | ||
| note: cycle used when optimizing promoted MIR for `main` | ||
| --> $DIR/defaults-cyclic-fail.rs:16:16 | ||
| | | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 whereLLis single or triple digit? I highly suspect this is not correct.