Skip to content

Commit 2dc815c

Browse files
committed
Rollup merge of #47417 - petrochenkov:noasm, r=estebank
Move "no asm" check into AST validation
2 parents 63f4285 + 318cf22 commit 2dc815c

File tree

4 files changed

+4
-53
lines changed

4 files changed

+4
-53
lines changed

src/librustc_driver/driver.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ use rustc_typeck as typeck;
3737
use rustc_privacy;
3838
use rustc_plugin::registry::Registry;
3939
use rustc_plugin as plugin;
40-
use rustc_passes::{self, ast_validation, no_asm, loops, consts, static_recursion, hir_stats};
40+
use rustc_passes::{self, ast_validation, loops, consts, static_recursion, hir_stats};
4141
use rustc_const_eval::{self, check_match};
4242
use super::Compilation;
4343
use ::DefaultTransCrate;
@@ -852,10 +852,6 @@ pub fn phase_2_configure_and_expand<F>(sess: &Session,
852852
println!("{}", json::as_json(&krate));
853853
}
854854

855-
time(time_passes,
856-
"checking for inline asm in case the target doesn't support it",
857-
|| no_asm::check_crate(sess, &krate));
858-
859855
time(time_passes,
860856
"AST validation",
861857
|| ast_validation::check_crate(sess, &krate));

src/librustc_passes/ast_validation.rs

+3
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,9 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
149149
ExprKind::Continue(Some(ident)) => {
150150
self.check_label(ident.node, ident.span);
151151
}
152+
ExprKind::InlineAsm(..) if !self.session.target.target.options.allow_asm => {
153+
span_err!(self.session, expr.span, E0472, "asm! is unsupported on this target");
154+
}
152155
_ => {}
153156
}
154157

src/librustc_passes/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ pub mod consts;
4242
pub mod hir_stats;
4343
pub mod loops;
4444
mod mir_stats;
45-
pub mod no_asm;
4645
pub mod static_recursion;
4746

4847
#[cfg(not(stage0))] // remove after the next snapshot

src/librustc_passes/no_asm.rs

-47
This file was deleted.

0 commit comments

Comments
 (0)