Skip to content

Commit 3edbf5d

Browse files
committed
impl IntoDiagArg for NonterminalKind
1 parent 39c6b1a commit 3edbf5d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

compiler/rustc_errors/src/diagnostic_impls.rs

+7
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use std::num::ParseIntError;
55
use std::path::{Path, PathBuf};
66
use std::process::ExitStatus;
77

8+
use rustc_ast::token::NonterminalKind;
89
use rustc_ast_pretty::pprust;
910
use rustc_macros::Subdiagnostic;
1011
use rustc_span::edition::Edition;
@@ -304,6 +305,12 @@ impl IntoDiagArg for hir::def::Namespace {
304305
}
305306
}
306307

308+
impl IntoDiagArg for NonterminalKind {
309+
fn into_diag_arg(self) -> DiagArgValue {
310+
DiagArgValue::Str(Cow::from(self.to_string()))
311+
}
312+
}
313+
307314
#[derive(Clone)]
308315
pub struct DiagSymbolList<S = Symbol>(Vec<S>);
309316

0 commit comments

Comments
 (0)