Skip to content
6 changes: 6 additions & 0 deletions compiler/rustc_errors/src/diagnostic_impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,12 @@ impl IntoDiagArg for ast::token::TokenKind {
}
}

impl IntoDiagArg for ast::tokenstream::TokenTree {
fn into_diag_arg(self) -> DiagArgValue {
DiagArgValue::Str(Cow::Owned(pprust::tt_to_string(&self)))
}
}

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?

impl IntoDiagArg for FloatTy {
fn into_diag_arg(self) -> DiagArgValue {
DiagArgValue::Str(Cow::Borrowed(self.name_str()))
Expand Down