Port #[custom_mir(..)] to the new attribute system
This commit is contained in:
@@ -9,6 +9,7 @@ use rustc_abi::TargetDataLayoutErrors;
|
||||
use rustc_ast::util::parser::ExprPrecedence;
|
||||
use rustc_ast_pretty::pprust;
|
||||
use rustc_hir::RustcVersion;
|
||||
use rustc_hir::attrs::{MirDialect, MirPhase};
|
||||
use rustc_macros::Subdiagnostic;
|
||||
use rustc_span::edition::Edition;
|
||||
use rustc_span::{Ident, MacroRulesNormalizedIdent, Span, Symbol};
|
||||
@@ -312,6 +313,28 @@ impl IntoDiagArg for ExprPrecedence {
|
||||
}
|
||||
}
|
||||
|
||||
impl IntoDiagArg for MirDialect {
|
||||
fn into_diag_arg(self, _path: &mut Option<PathBuf>) -> DiagArgValue {
|
||||
let arg = match self {
|
||||
MirDialect::Analysis => "analysis",
|
||||
MirDialect::Built => "built",
|
||||
MirDialect::Runtime => "runtime",
|
||||
};
|
||||
DiagArgValue::Str(Cow::Borrowed(arg))
|
||||
}
|
||||
}
|
||||
|
||||
impl IntoDiagArg for MirPhase {
|
||||
fn into_diag_arg(self, _path: &mut Option<PathBuf>) -> DiagArgValue {
|
||||
let arg = match self {
|
||||
MirPhase::Initial => "initial",
|
||||
MirPhase::PostCleanup => "post-cleanup",
|
||||
MirPhase::Optimized => "optimized",
|
||||
};
|
||||
DiagArgValue::Str(Cow::Borrowed(arg))
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct DiagSymbolList<S = Symbol>(Vec<S>);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user