From de3e8ca2f3908dc48fddb0d5b4c14c776017b43e Mon Sep 17 00:00:00 2001 From: David Wood Date: Sat, 7 May 2022 07:26:03 +0100 Subject: errors: `set_arg` takes `IntoDiagnosticArg` Manual implementors of translatable diagnostics will need to call `set_arg`, not just the derive, so make this function a bit more ergonomic by taking `IntoDiagnosticArg` rather than `DiagnosticArgValue`. Signed-off-by: David Wood --- compiler/rustc_errors/src/diagnostic.rs | 4 ++-- compiler/rustc_errors/src/diagnostic_builder.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'compiler/rustc_errors/src') diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs index 83e6a751394..909ed566f64 100644 --- a/compiler/rustc_errors/src/diagnostic.rs +++ b/compiler/rustc_errors/src/diagnostic.rs @@ -821,9 +821,9 @@ impl Diagnostic { pub fn set_arg( &mut self, name: impl Into>, - arg: DiagnosticArgValue<'static>, + arg: impl IntoDiagnosticArg, ) -> &mut Self { - self.args.push((name.into(), arg)); + self.args.push((name.into(), arg.into_diagnostic_arg())); self } diff --git a/compiler/rustc_errors/src/diagnostic_builder.rs b/compiler/rustc_errors/src/diagnostic_builder.rs index 96b730c2baa..53ad6e5a0ed 100644 --- a/compiler/rustc_errors/src/diagnostic_builder.rs +++ b/compiler/rustc_errors/src/diagnostic_builder.rs @@ -1,4 +1,4 @@ -use crate::diagnostic::DiagnosticArgValue; +use crate::diagnostic::IntoDiagnosticArg; use crate::{Diagnostic, DiagnosticId, DiagnosticMessage, DiagnosticStyledString, ErrorGuaranteed}; use crate::{Handler, Level, MultiSpan, StashKey}; use rustc_lint_defs::Applicability; @@ -528,7 +528,7 @@ impl<'a, G: EmissionGuarantee> DiagnosticBuilder<'a, G> { forward!(pub fn set_arg( &mut self, name: impl Into>, - arg: DiagnosticArgValue<'static>, + arg: impl IntoDiagnosticArg, ) -> &mut Self); forward!(pub fn subdiagnostic( -- cgit 1.4.1-3-g733a5