diff options
| author | David Wood <david.wood@huawei.com> | 2022-03-31 10:24:46 +0100 |
|---|---|---|
| committer | David Wood <david.wood@huawei.com> | 2022-04-05 07:01:03 +0100 |
| commit | a88717cef051b8ebbed0e74c57fc0a714bd893dc (patch) | |
| tree | da04f2a5e842261b84379a6b240700367f6127e5 /compiler/rustc_errors | |
| parent | 72dec56028d848ba18a7e1a9bf9da0b6faf5f7da (diff) | |
| download | rust-a88717cef051b8ebbed0e74c57fc0a714bd893dc.tar.gz rust-a88717cef051b8ebbed0e74c57fc0a714bd893dc.zip | |
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>
Diffstat (limited to 'compiler/rustc_errors')
| -rw-r--r-- | compiler/rustc_errors/src/diagnostic.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_errors/src/diagnostic_builder.rs | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs index 74abffa7dfa..ecb3cdd627c 100644 --- a/compiler/rustc_errors/src/diagnostic.rs +++ b/compiler/rustc_errors/src/diagnostic.rs @@ -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 } diff --git a/compiler/rustc_errors/src/diagnostic_builder.rs b/compiler/rustc_errors/src/diagnostic_builder.rs index 2cee1354cc7..74e0f742946 100644 --- a/compiler/rustc_errors/src/diagnostic_builder.rs +++ b/compiler/rustc_errors/src/diagnostic_builder.rs @@ -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. |
