Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More translatable diagnostics #123822

Closed
wants to merge 12 commits into from
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