Skip to content

Commit b03710d

Browse files
authored
Unrolled build for #147406
Rollup merge of #147406 - jchecahi:remove-needs-asm-support-explicit, r=cuviper 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.
2 parents e4407c0 + d75b2ba commit b03710d

37 files changed

+846
-855
lines changed

src/doc/rustc-dev-guide/src/tests/directives.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,10 @@ Some examples of `X` in `ignore-X` or `only-X`:
163163
The following directives will check rustc build settings and target
164164
settings:
165165

166-
- `needs-asm-support` — ignores if it is running on a target that doesn't have
167-
stable support for `asm!`
166+
- `needs-asm-support` — ignores if the **host** architecture doesn't have
167+
stable support for `asm!`. For tests that cross-compile to explicit targets
168+
via `--target`, use `needs-llvm-components` instead to ensure the appropriate
169+
backend is available.
168170
- `needs-profiler-runtime` — ignores the test if the profiler runtime was not
169171
enabled for the target
170172
(`build.profiler = true` in rustc's `bootstrap.toml`)

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
//@ ignore-backends: gcc
65

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:19:18
2+
--> $DIR/arm64ec-sve.rs:18: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:21:18
8+
--> $DIR/arm64ec-sve.rs:20: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:22:15
18+
--> $DIR/inline-syntax.rs:21: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:25:15
30+
--> $DIR/inline-syntax.rs:24: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:28:15
42+
--> $DIR/inline-syntax.rs:27: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:31:15
54+
--> $DIR/inline-syntax.rs:30: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:34:15
66+
--> $DIR/inline-syntax.rs:33: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:40:13
78+
--> $DIR/inline-syntax.rs:39: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
//@ ignore-backends: gcc
1211

1312
#![feature(no_core)]

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:48:14
2+
--> $DIR/inline-syntax.rs:47: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:22:15
10+
--> $DIR/inline-syntax.rs:21: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:25:15
16+
--> $DIR/inline-syntax.rs:24: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:28:15
22+
--> $DIR/inline-syntax.rs:27: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:31:15
28+
--> $DIR/inline-syntax.rs:30: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:34:15
34+
--> $DIR/inline-syntax.rs:33: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:40:13
40+
--> $DIR/inline-syntax.rs:39: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
//@ ignore-backends: gcc
76

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
//@ ignore-backends: gcc
65

76
#![feature(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:16:18
2+
--> $DIR/issue-99071.rs:15: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:27:18
2+
--> $DIR/bad-reg.rs:26:18
33
|
44
LL | asm!("", out("$r0") _);
55
| ^^^^^^^^^^^^
66

77
error: invalid register `$tp`: reserved for TLS
8-
--> $DIR/bad-reg.rs:29:18
8+
--> $DIR/bad-reg.rs:28: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:31:18
14+
--> $DIR/bad-reg.rs:30:18
1515
|
1616
LL | asm!("", out("$sp") _);
1717
| ^^^^^^^^^^^^
1818

1919
error: invalid register `$r21`: reserved by the ABI
20-
--> $DIR/bad-reg.rs:33:18
20+
--> $DIR/bad-reg.rs:32: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:35:18
26+
--> $DIR/bad-reg.rs:34: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:37:18
32+
--> $DIR/bad-reg.rs:36:18
3333
|
3434
LL | asm!("", out("$r31") _);
3535
| ^^^^^^^^^^^^^

0 commit comments

Comments
 (0)