-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
DiagnosticBuilder::span_label (sometimes?) does nothing #71857
Copy link
Copy link
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Recently, I was constructing a diagnostic with code like this:
I expected this to print a warning with a bunch of labels pointing to the given spans attached to it. But instead, the labels are just entirely ignored.
I am now using
span_helpinstead, but that's a gross hack as this is not a "help" information. (This warning is for permanently unstable nightly-only testing flags, so it's not a big deal.) Unfortunately thespan_labeldoc comment is also not very helpful, talking about the internal representation of the diagnostic builder ("multispan" etc) and about what happens when I do not call this method (?!?) but not about why adding a label might just have no effect at all.Cc @rust-lang/wg-diagnostics which hopefully has people that actually understand this API, unlike me. :)