Skip to content

Commit 441d98f

Browse files
committed
Expand feature gate testing for asm_const/asm_sym
1 parent b1c6c06 commit 441d98f

File tree

4 files changed

+40
-7
lines changed

4 files changed

+40
-7
lines changed

Diff for: src/test/ui/feature-gates/feature-gate-asm_const.rs

+6
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,14 @@
22

33
use std::arch::asm;
44

5+
unsafe fn foo<const N: usize>() {
6+
asm!("mov eax, {}", const N + 1);
7+
//~^ ERROR const operands for inline assembly are unstable
8+
}
9+
510
fn main() {
611
unsafe {
12+
foo::<0>();
713
asm!("mov eax, {}", const 123);
814
//~^ ERROR const operands for inline assembly are unstable
915
}
+11-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
error[E0658]: const operands for inline assembly are unstable
2-
--> $DIR/feature-gate-asm_const.rs:7:29
2+
--> $DIR/feature-gate-asm_const.rs:6:25
3+
|
4+
LL | asm!("mov eax, {}", const N + 1);
5+
| ^^^^^^^^^^^
6+
|
7+
= note: see issue #93332 <https://github.com/rust-lang/rust/issues/93332> for more information
8+
= help: add `#![feature(asm_const)]` to the crate attributes to enable
9+
10+
error[E0658]: const operands for inline assembly are unstable
11+
--> $DIR/feature-gate-asm_const.rs:13:29
312
|
413
LL | asm!("mov eax, {}", const 123);
514
| ^^^^^^^^^
615
|
716
= note: see issue #93332 <https://github.com/rust-lang/rust/issues/93332> for more information
817
= help: add `#![feature(asm_const)]` to the crate attributes to enable
918

10-
error: aborting due to previous error
19+
error: aborting due to 2 previous errors
1120

1221
For more information about this error, try `rustc --explain E0658`.

Diff for: src/test/ui/feature-gates/feature-gate-asm_sym.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,18 @@
22

33
use std::arch::asm;
44

5+
fn bar<const N: usize>() {}
6+
7+
fn foo<const N: usize>() {
8+
unsafe {
9+
asm!("mov eax, {}", sym bar::<N>);
10+
//~^ ERROR sym operands for inline assembly are unstable
11+
}
12+
}
13+
514
fn main() {
615
unsafe {
7-
asm!("mov eax, {}", sym main);
16+
asm!("mov eax, {}", sym foo::<0>);
817
//~^ ERROR sym operands for inline assembly are unstable
918
}
1019
}
+13-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
error[E0658]: sym operands for inline assembly are unstable
2-
--> $DIR/feature-gate-asm_sym.rs:7:29
2+
--> $DIR/feature-gate-asm_sym.rs:9:29
33
|
4-
LL | asm!("mov eax, {}", sym main);
5-
| ^^^^^^^^
4+
LL | asm!("mov eax, {}", sym bar::<N>);
5+
| ^^^^^^^^^^^^
66
|
77
= note: see issue #93333 <https://github.com/rust-lang/rust/issues/93333> for more information
88
= help: add `#![feature(asm_sym)]` to the crate attributes to enable
99

10-
error: aborting due to previous error
10+
error[E0658]: sym operands for inline assembly are unstable
11+
--> $DIR/feature-gate-asm_sym.rs:16:29
12+
|
13+
LL | asm!("mov eax, {}", sym foo::<0>);
14+
| ^^^^^^^^^^^^
15+
|
16+
= note: see issue #93333 <https://github.com/rust-lang/rust/issues/93333> for more information
17+
= help: add `#![feature(asm_sym)]` to the crate attributes to enable
18+
19+
error: aborting due to 2 previous errors
1120

1221
For more information about this error, try `rustc --explain E0658`.

0 commit comments

Comments
 (0)