1
Fork 0

Make some IntoDiagnostic impls generic.

PR #119097 made the decision to make all `IntoDiagnostic` impls generic,
because this allowed a bunch of nice cleanups. But four hand-written
impls were unintentionally overlooked. This commit makes them generic.
This commit is contained in:
Nicholas Nethercote 2024-02-22 12:36:01 +11:00
parent 326b44e4d3
commit 02423a5747
3 changed files with 12 additions and 10 deletions

View file

@ -1073,9 +1073,9 @@ pub(crate) struct ExpectedIdentifier {
pub help_cannot_start_number: Option<HelpIdentifierStartsWithNumber>,
}
impl<'a> IntoDiagnostic<'a> for ExpectedIdentifier {
impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G> for ExpectedIdentifier {
#[track_caller]
fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> DiagnosticBuilder<'a> {
fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> DiagnosticBuilder<'a, G> {
let token_descr = TokenDescription::from_token(&self.token);
let mut diag = DiagnosticBuilder::new(
@ -1133,9 +1133,9 @@ pub(crate) struct ExpectedSemi {
pub sugg: ExpectedSemiSugg,
}
impl<'a> IntoDiagnostic<'a> for ExpectedSemi {
impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G> for ExpectedSemi {
#[track_caller]
fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> DiagnosticBuilder<'a> {
fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> DiagnosticBuilder<'a, G> {
let token_descr = TokenDescription::from_token(&self.token);
let mut diag = DiagnosticBuilder::new(