Skip to content

Commit bb6bec1

Browse files
committed
Clarify error message when both asm! and global_asm! are unsupported
1 parent 0df83f8 commit bb6bec1

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

compiler/rustc_ast_lowering/src/asm.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1515
// lowering the register contraints in this case.
1616
let asm_arch = if self.sess.opts.actually_rustdoc { None } else { self.sess.asm_arch };
1717
if asm_arch.is_none() && !self.sess.opts.actually_rustdoc {
18-
struct_span_err!(self.sess, sp, E0472, "asm! is unsupported on this target").emit();
18+
struct_span_err!(self.sess, sp, E0472, "inline assembly is unsupported on this target")
19+
.emit();
1920
}
2021
if asm.options.contains(InlineAsmOptions::ATT_SYNTAX)
2122
&& !matches!(asm_arch, Some(asm::InlineAsmArch::X86 | asm::InlineAsmArch::X86_64))

src/test/ui/asm/bad-arch.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ trait Sized {}
1818
fn main() {
1919
unsafe {
2020
asm!("");
21-
//~^ ERROR asm! is unsupported on this target
21+
//~^ ERROR inline assembly is unsupported on this target
2222
}
2323
}
2424

2525
global_asm!("");
26-
//~^ ERROR asm! is unsupported on this target
26+
//~^ ERROR inline assembly is unsupported on this target

src/test/ui/asm/bad-arch.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
error[E0472]: asm! is unsupported on this target
1+
error[E0472]: inline assembly is unsupported on this target
22
--> $DIR/bad-arch.rs:20:9
33
|
44
LL | asm!("");
55
| ^^^^^^^^^
66

7-
error[E0472]: asm! is unsupported on this target
7+
error[E0472]: inline assembly is unsupported on this target
88
--> $DIR/bad-arch.rs:25:1
99
|
1010
LL | global_asm!("");

0 commit comments

Comments
 (0)