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

Support Sub-diagnostics with spans #88

Open
Muscraft opened this issue Mar 4, 2024 · 1 comment
Open

Support Sub-diagnostics with spans #88

Muscraft opened this issue Mar 4, 2024 · 1 comment
Labels
C-enhancement Category: enhancement
Milestone

Comments

@Muscraft
Copy link
Contributor

Muscraft commented Mar 4, 2024

Currently, sub-diagnostics are handled by adding Annotation's to Snippet::footer. This system is fine, but it does not support sub-diagnostics with a span. This is needed for rust adoption as Subdiag can have spans.

One thing to note is that sub-diagnostics are rendered differently depending on if they have a span or they don't have any.

error[E0000]: main error message
  --> file.rs:LL:CC
   |
LL | <code>
   | -^^^^- secondary label
   |  |
   |  primary label
   |
   = note: note without a `Span`, created with `.note`
note: sub-diagnostic message for `.span_note`
  --> file.rs:LL:CC
   |
LL | more code
   |      ^^^^

Since spans need a source, sub-diagnostics should probably need to be moved under Slice or something similar. This does bring up the question of where we should show a sub-diagnostic, at the end of a Snippet, or at the end of source the span is associated with.

@epage epage added this to the Rust Adoption milestone Mar 4, 2024
@epage epage added the C-enhancement Category: enhancement label Mar 4, 2024
@epage
Copy link
Contributor

epage commented Mar 13, 2024

#98 generalized footer but has not vetted the output to make sure it looks like what rustc needs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: enhancement
Projects
None yet
Development

No branches or pull requests

2 participants