macros: support translatable labels
Extends support for generating `DiagnosticMessage::FluentIdentifier` messages from `SessionDiagnostic` derive to `#[label]`. Signed-off-by: David Wood <david.wood@huawei.com>
This commit is contained in:
parent
72dec56028
commit
a88717cef0
8 changed files with 140 additions and 95 deletions
|
@ -277,7 +277,7 @@ impl Diagnostic {
|
|||
///
|
||||
/// This span is *not* considered a ["primary span"][`MultiSpan`]; only
|
||||
/// the `Span` supplied when creating the diagnostic is primary.
|
||||
pub fn span_label<T: Into<String>>(&mut self, span: Span, label: T) -> &mut Self {
|
||||
pub fn span_label(&mut self, span: Span, label: impl Into<DiagnosticMessage>) -> &mut Self {
|
||||
self.span.push_span_label(span, label.into());
|
||||
self
|
||||
}
|
||||
|
|
|
@ -408,7 +408,7 @@ impl<'a, G: EmissionGuarantee> DiagnosticBuilder<'a, G> {
|
|||
/// the diagnostic was constructed. However, the label span is *not* considered a
|
||||
/// ["primary span"][`MultiSpan`]; only the `Span` supplied when creating the diagnostic is
|
||||
/// primary.
|
||||
pub fn span_label(&mut self, span: Span, label: impl Into<String>) -> &mut Self);
|
||||
pub fn span_label(&mut self, span: Span, label: impl Into<DiagnosticMessage>) -> &mut Self);
|
||||
|
||||
forward!(
|
||||
/// Labels all the given spans with the provided label.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue