diff options
| author | Jake Goulding <jake.goulding@gmail.com> | 2025-03-21 10:09:17 -0400 |
|---|---|---|
| committer | Jake Goulding <jake.goulding@gmail.com> | 2025-04-16 21:38:59 -0400 |
| commit | 01178849174bdff3e3e951827d9ea4884c23b758 (patch) | |
| tree | 6d31d9058e1ef856ed57631bc0210f129190b547 /compiler/rustc_parse/src/errors.rs | |
| parent | 78f2104e334068d5a892a170d50193c0025c690e (diff) | |
| download | rust-01178849174bdff3e3e951827d9ea4884c23b758.tar.gz rust-01178849174bdff3e3e951827d9ea4884c23b758.zip | |
Move eager translation to a method on `Diag`
This will allow us to eagerly translate messages on a top-level diagnostic, such as a `LintDiagnostic`. As a bonus, we can remove the awkward closure passed into Subdiagnostic and make better use of `Into`.
Diffstat (limited to 'compiler/rustc_parse/src/errors.rs')
| -rw-r--r-- | compiler/rustc_parse/src/errors.rs | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/compiler/rustc_parse/src/errors.rs b/compiler/rustc_parse/src/errors.rs index dfdef018bc3..57534bc8c31 100644 --- a/compiler/rustc_parse/src/errors.rs +++ b/compiler/rustc_parse/src/errors.rs @@ -7,8 +7,7 @@ use rustc_ast::util::parser::ExprPrecedence; use rustc_ast::{Path, Visibility}; use rustc_errors::codes::*; use rustc_errors::{ - Applicability, Diag, DiagCtxtHandle, Diagnostic, EmissionGuarantee, Level, SubdiagMessageOp, - Subdiagnostic, + Applicability, Diag, DiagCtxtHandle, Diagnostic, EmissionGuarantee, Level, Subdiagnostic, }; use rustc_macros::{Diagnostic, Subdiagnostic}; use rustc_session::errors::ExprParenthesesNeeded; @@ -1551,11 +1550,7 @@ pub(crate) struct FnTraitMissingParen { } impl Subdiagnostic for FnTraitMissingParen { - fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>( - self, - diag: &mut Diag<'_, G>, - _: &F, - ) { + fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) { diag.span_label(self.span, crate::fluent_generated::parse_fn_trait_missing_paren); diag.span_suggestion_short( self.span.shrink_to_hi(), |
