Skip to content

Commit d2aaa62

Browse files
author
Jesus Checa Hidalgo
committed
Remove needs-asm-support directive in tests with explicit targets
The `needs-asm-support` directive checks whether the host architecture supports inline assembly, not the target architecture. For tests that explicitly specify a target via `--target` in their compile-flags, this directive is incorrect and unnecessary. These tests are cross-compiling to specific targets (like x86_64, arm, aarch64, riscv, etc.) that are already known to have stable asm support. The directive was causing these tests to be incorrectly skipped on hosts that don't support asm, even though the target does. Tests with explicit targets should rely on `needs-llvm-components` to ensure the appropriate backend is available, rather than checking host asm support.
1 parent d2acb42 commit d2aaa62

36 files changed

+560
-571
lines changed

tests/ui/asm/aarch64/arm64ec-sve.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
//@ add-core-stubs
22
//@ compile-flags: --target arm64ec-pc-windows-msvc
3-
//@ needs-asm-support
43
//@ needs-llvm-components: aarch64
54

65
#![crate_type = "rlib"]

tests/ui/asm/aarch64/arm64ec-sve.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error: cannot use register `p0`: x13, x14, x23, x24, x28, v16-v31, p*, ffr cannot be used for Arm64EC
2-
--> $DIR/arm64ec-sve.rs:18:18
2+
--> $DIR/arm64ec-sve.rs:17:18
33
|
44
LL | asm!("", out("p0") _);
55
| ^^^^^^^^^^^
66

77
error: cannot use register `ffr`: x13, x14, x23, x24, x28, v16-v31, p*, ffr cannot be used for Arm64EC
8-
--> $DIR/arm64ec-sve.rs:20:18
8+
--> $DIR/arm64ec-sve.rs:19:18
99
|
1010
LL | asm!("", out("ffr") _);
1111
| ^^^^^^^^^^^^

tests/ui/asm/inline-syntax.arm.stderr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ LL | .intel_syntax noprefix
1515
| ^
1616

1717
error: unknown directive
18-
--> $DIR/inline-syntax.rs:21:15
18+
--> $DIR/inline-syntax.rs:20:15
1919
|
2020
LL | asm!(".intel_syntax noprefix", "nop");
2121
| ^^^^^^^^^^^^^^^^^^^^^^
@@ -27,7 +27,7 @@ LL | .intel_syntax noprefix
2727
| ^
2828

2929
error: unknown directive
30-
--> $DIR/inline-syntax.rs:24:15
30+
--> $DIR/inline-syntax.rs:23:15
3131
|
3232
LL | asm!(".intel_syntax aaa noprefix", "nop");
3333
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -39,7 +39,7 @@ LL | .intel_syntax aaa noprefix
3939
| ^
4040

4141
error: unknown directive
42-
--> $DIR/inline-syntax.rs:27:15
42+
--> $DIR/inline-syntax.rs:26:15
4343
|
4444
LL | asm!(".att_syntax noprefix", "nop");
4545
| ^^^^^^^^^^^^^^^^^^^^
@@ -51,7 +51,7 @@ LL | .att_syntax noprefix
5151
| ^
5252

5353
error: unknown directive
54-
--> $DIR/inline-syntax.rs:30:15
54+
--> $DIR/inline-syntax.rs:29:15
5555
|
5656
LL | asm!(".att_syntax bbb noprefix", "nop");
5757
| ^^^^^^^^^^^^^^^^^^^^^^^^
@@ -63,7 +63,7 @@ LL | .att_syntax bbb noprefix
6363
| ^
6464

6565
error: unknown directive
66-
--> $DIR/inline-syntax.rs:33:15
66+
--> $DIR/inline-syntax.rs:32:15
6767
|
6868
LL | asm!(".intel_syntax noprefix; nop");
6969
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -75,7 +75,7 @@ LL | .intel_syntax noprefix; nop
7575
| ^
7676

7777
error: unknown directive
78-
--> $DIR/inline-syntax.rs:39:13
78+
--> $DIR/inline-syntax.rs:38:13
7979
|
8080
LL | .intel_syntax noprefix
8181
| ^^^^^^^^^^^^^^^^^^^^^^

tests/ui/asm/inline-syntax.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
//@[arm] compile-flags: --target armv7-unknown-linux-gnueabihf
88
//@[arm] build-fail
99
//@[arm] needs-llvm-components: arm
10-
//@ needs-asm-support
1110

1211
#![feature(no_core)]
1312
#![crate_type = "rlib"]

tests/ui/asm/inline-syntax.x86_64.stderr

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,43 @@
11
warning: avoid using `.intel_syntax`, Intel syntax is the default
2-
--> $DIR/inline-syntax.rs:47:14
2+
--> $DIR/inline-syntax.rs:46:14
33
|
44
LL | global_asm!(".intel_syntax noprefix", "nop");
55
| ^^^^^^^^^^^^^^^^^^^^^^
66
|
77
= note: `#[warn(bad_asm_style)]` on by default
88

99
warning: avoid using `.intel_syntax`, Intel syntax is the default
10-
--> $DIR/inline-syntax.rs:21:15
10+
--> $DIR/inline-syntax.rs:20:15
1111
|
1212
LL | asm!(".intel_syntax noprefix", "nop");
1313
| ^^^^^^^^^^^^^^^^^^^^^^
1414

1515
warning: avoid using `.intel_syntax`, Intel syntax is the default
16-
--> $DIR/inline-syntax.rs:24:15
16+
--> $DIR/inline-syntax.rs:23:15
1717
|
1818
LL | asm!(".intel_syntax aaa noprefix", "nop");
1919
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
2020

2121
warning: avoid using `.att_syntax`, prefer using `options(att_syntax)` instead
22-
--> $DIR/inline-syntax.rs:27:15
22+
--> $DIR/inline-syntax.rs:26:15
2323
|
2424
LL | asm!(".att_syntax noprefix", "nop");
2525
| ^^^^^^^^^^^^^^^^^^^^
2626

2727
warning: avoid using `.att_syntax`, prefer using `options(att_syntax)` instead
28-
--> $DIR/inline-syntax.rs:30:15
28+
--> $DIR/inline-syntax.rs:29:15
2929
|
3030
LL | asm!(".att_syntax bbb noprefix", "nop");
3131
| ^^^^^^^^^^^^^^^^^^^^^^^^
3232

3333
warning: avoid using `.intel_syntax`, Intel syntax is the default
34-
--> $DIR/inline-syntax.rs:33:15
34+
--> $DIR/inline-syntax.rs:32:15
3535
|
3636
LL | asm!(".intel_syntax noprefix; nop");
3737
| ^^^^^^^^^^^^^^^^^^^^^^
3838

3939
warning: avoid using `.intel_syntax`, Intel syntax is the default
40-
--> $DIR/inline-syntax.rs:39:13
40+
--> $DIR/inline-syntax.rs:38:13
4141
|
4242
LL | .intel_syntax noprefix
4343
| ^^^^^^^^^^^^^^^^^^^^^^

tests/ui/asm/issue-92378.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
//@ add-core-stubs
22
//@ compile-flags: --target armv5te-unknown-linux-gnueabi
33
//@ needs-llvm-components: arm
4-
//@ needs-asm-support
54
//@ build-pass
65

76
#![feature(no_core)]

tests/ui/asm/issue-99071.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
//@ add-core-stubs
22
//@ compile-flags: --target thumbv6m-none-eabi
33
//@ needs-llvm-components: arm
4-
//@ needs-asm-support
54

65
#![feature(no_core)]
76
#![no_core]

tests/ui/asm/issue-99071.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: cannot use register `r8`: high registers (r8+) can only be used as clobbers in Thumb-1 code
2-
--> $DIR/issue-99071.rs:15:18
2+
--> $DIR/issue-99071.rs:14:18
33
|
44
LL | asm!("", in("r8") 0);
55
| ^^^^^^^^^^

tests/ui/asm/loongarch/bad-reg.loongarch32_ilp32d.stderr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
11
error: invalid register `$r0`: constant zero cannot be used as an operand for inline asm
2-
--> $DIR/bad-reg.rs:26:18
2+
--> $DIR/bad-reg.rs:25:18
33
|
44
LL | asm!("", out("$r0") _);
55
| ^^^^^^^^^^^^
66

77
error: invalid register `$tp`: reserved for TLS
8-
--> $DIR/bad-reg.rs:28:18
8+
--> $DIR/bad-reg.rs:27:18
99
|
1010
LL | asm!("", out("$tp") _);
1111
| ^^^^^^^^^^^^
1212

1313
error: invalid register `$sp`: the stack pointer cannot be used as an operand for inline asm
14-
--> $DIR/bad-reg.rs:30:18
14+
--> $DIR/bad-reg.rs:29:18
1515
|
1616
LL | asm!("", out("$sp") _);
1717
| ^^^^^^^^^^^^
1818

1919
error: invalid register `$r21`: reserved by the ABI
20-
--> $DIR/bad-reg.rs:32:18
20+
--> $DIR/bad-reg.rs:31:18
2121
|
2222
LL | asm!("", out("$r21") _);
2323
| ^^^^^^^^^^^^^
2424

2525
error: invalid register `$fp`: the frame pointer cannot be used as an operand for inline asm
26-
--> $DIR/bad-reg.rs:34:18
26+
--> $DIR/bad-reg.rs:33:18
2727
|
2828
LL | asm!("", out("$fp") _);
2929
| ^^^^^^^^^^^^
3030

3131
error: invalid register `$r31`: $r31 is used internally by LLVM and cannot be used as an operand for inline asm
32-
--> $DIR/bad-reg.rs:36:18
32+
--> $DIR/bad-reg.rs:35:18
3333
|
3434
LL | asm!("", out("$r31") _);
3535
| ^^^^^^^^^^^^^

tests/ui/asm/loongarch/bad-reg.loongarch32_ilp32s.stderr

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,59 @@
11
error: invalid register `$r0`: constant zero cannot be used as an operand for inline asm
2-
--> $DIR/bad-reg.rs:26:18
2+
--> $DIR/bad-reg.rs:25:18
33
|
44
LL | asm!("", out("$r0") _);
55
| ^^^^^^^^^^^^
66

77
error: invalid register `$tp`: reserved for TLS
8-
--> $DIR/bad-reg.rs:28:18
8+
--> $DIR/bad-reg.rs:27:18
99
|
1010
LL | asm!("", out("$tp") _);
1111
| ^^^^^^^^^^^^
1212

1313
error: invalid register `$sp`: the stack pointer cannot be used as an operand for inline asm
14-
--> $DIR/bad-reg.rs:30:18
14+
--> $DIR/bad-reg.rs:29:18
1515
|
1616
LL | asm!("", out("$sp") _);
1717
| ^^^^^^^^^^^^
1818

1919
error: invalid register `$r21`: reserved by the ABI
20-
--> $DIR/bad-reg.rs:32:18
20+
--> $DIR/bad-reg.rs:31:18
2121
|
2222
LL | asm!("", out("$r21") _);
2323
| ^^^^^^^^^^^^^
2424

2525
error: invalid register `$fp`: the frame pointer cannot be used as an operand for inline asm
26-
--> $DIR/bad-reg.rs:34:18
26+
--> $DIR/bad-reg.rs:33:18
2727
|
2828
LL | asm!("", out("$fp") _);
2929
| ^^^^^^^^^^^^
3030

3131
error: invalid register `$r31`: $r31 is used internally by LLVM and cannot be used as an operand for inline asm
32-
--> $DIR/bad-reg.rs:36:18
32+
--> $DIR/bad-reg.rs:35:18
3333
|
3434
LL | asm!("", out("$r31") _);
3535
| ^^^^^^^^^^^^^
3636

3737
error: register class `freg` requires at least one of the following target features: d, f
38-
--> $DIR/bad-reg.rs:40:26
38+
--> $DIR/bad-reg.rs:39:26
3939
|
4040
LL | asm!("/* {} */", in(freg) f);
4141
| ^^^^^^^^^^
4242

4343
error: register class `freg` requires at least one of the following target features: d, f
44-
--> $DIR/bad-reg.rs:42:26
44+
--> $DIR/bad-reg.rs:41:26
4545
|
4646
LL | asm!("/* {} */", out(freg) _);
4747
| ^^^^^^^^^^^
4848

4949
error: register class `freg` requires at least one of the following target features: d, f
50-
--> $DIR/bad-reg.rs:44:26
50+
--> $DIR/bad-reg.rs:43:26
5151
|
5252
LL | asm!("/* {} */", in(freg) d);
5353
| ^^^^^^^^^^
5454

5555
error: register class `freg` requires at least one of the following target features: d, f
56-
--> $DIR/bad-reg.rs:46:26
56+
--> $DIR/bad-reg.rs:45:26
5757
|
5858
LL | asm!("/* {} */", out(freg) d);
5959
| ^^^^^^^^^^^

0 commit comments

Comments
 (0)