parent
c15bae53b5
commit
9abdb6db6f
5 changed files with 29 additions and 3 deletions
|
@ -1067,7 +1067,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
// Stop if there were any errors when lowering the register classes
|
// Stop if there were any errors when lowering the register classes
|
||||||
if operands.len() != asm.operands.len() {
|
if operands.len() != asm.operands.len() || sess.asm_arch.is_none() {
|
||||||
return hir::ExprKind::Err;
|
return hir::ExprKind::Err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
18
src/test/ui/asm/bad-arch.rs
Normal file
18
src/test/ui/asm/bad-arch.rs
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
// compile-flags: --target wasm32-unknown-unknown
|
||||||
|
|
||||||
|
#![feature(no_core, lang_items, rustc_attrs)]
|
||||||
|
#![no_core]
|
||||||
|
|
||||||
|
#[rustc_builtin_macro]
|
||||||
|
macro_rules! asm {
|
||||||
|
() => {};
|
||||||
|
}
|
||||||
|
#[lang = "sized"]
|
||||||
|
trait Sized {}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
unsafe {
|
||||||
|
asm!("");
|
||||||
|
//~^ ERROR asm! is unsupported on this target
|
||||||
|
}
|
||||||
|
}
|
8
src/test/ui/asm/bad-arch.stderr
Normal file
8
src/test/ui/asm/bad-arch.stderr
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
error[E0472]: asm! is unsupported on this target
|
||||||
|
--> $DIR/bad-arch.rs:15:9
|
||||||
|
|
|
||||||
|
LL | asm!("");
|
||||||
|
| ^^^^^^^^^
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// ignore-emscripten
|
// only-x86_64
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// ignore-emscripten
|
// only-x86_64
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue