Skip to content
7 changes: 7 additions & 0 deletions compiler/rustc_errors/src/diagnostic_impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use std::num::ParseIntError;
use std::path::{Path, PathBuf};
use std::process::ExitStatus;

use rustc_ast::token::NonterminalKind;
use rustc_ast_pretty::pprust;
use rustc_macros::Subdiagnostic;
use rustc_span::edition::Edition;
Expand Down Expand Up @@ -304,6 +305,12 @@ impl IntoDiagArg for hir::def::Namespace {
}
}

impl IntoDiagArg for NonterminalKind {
fn into_diag_arg(self) -> DiagArgValue {
DiagArgValue::Str(Cow::from(self.to_string()))
}
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you put this change in the commit where you actually use it?

#[derive(Clone)]
pub struct DiagSymbolList<S = Symbol>(Vec<S>);

Expand Down