Expand feature gate testing for asm_const/asm_sym

This commit is contained in:
Gary Guo 2022-05-10 22:02:37 +01:00
parent b1c6c0648e
commit 441d98f1a4
4 changed files with 41 additions and 8 deletions

View File

@ -2,8 +2,14 @@
use std::arch::asm;
unsafe fn foo<const N: usize>() {
asm!("mov eax, {}", const N + 1);
//~^ ERROR const operands for inline assembly are unstable
}
fn main() {
unsafe {
foo::<0>();
asm!("mov eax, {}", const 123);
//~^ ERROR const operands for inline assembly are unstable
}

View File

@ -1,5 +1,14 @@
error[E0658]: const operands for inline assembly are unstable
--> $DIR/feature-gate-asm_const.rs:7:29
--> $DIR/feature-gate-asm_const.rs:6:25
|
LL | asm!("mov eax, {}", const N + 1);
| ^^^^^^^^^^^
|
= note: see issue #93332 <https://github.com/rust-lang/rust/issues/93332> for more information
= help: add `#![feature(asm_const)]` to the crate attributes to enable
error[E0658]: const operands for inline assembly are unstable
--> $DIR/feature-gate-asm_const.rs:13:29
|
LL | asm!("mov eax, {}", const 123);
| ^^^^^^^^^
@ -7,6 +16,6 @@ LL | asm!("mov eax, {}", const 123);
= note: see issue #93332 <https://github.com/rust-lang/rust/issues/93332> for more information
= help: add `#![feature(asm_const)]` to the crate attributes to enable
error: aborting due to previous error
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0658`.

View File

@ -2,9 +2,18 @@
use std::arch::asm;
fn main() {
fn bar<const N: usize>() {}
fn foo<const N: usize>() {
unsafe {
asm!("mov eax, {}", sym main);
asm!("mov eax, {}", sym bar::<N>);
//~^ ERROR sym operands for inline assembly are unstable
}
}
fn main() {
unsafe {
asm!("mov eax, {}", sym foo::<0>);
//~^ ERROR sym operands for inline assembly are unstable
}
}

View File

@ -1,12 +1,21 @@
error[E0658]: sym operands for inline assembly are unstable
--> $DIR/feature-gate-asm_sym.rs:7:29
--> $DIR/feature-gate-asm_sym.rs:9:29
|
LL | asm!("mov eax, {}", sym main);
| ^^^^^^^^
LL | asm!("mov eax, {}", sym bar::<N>);
| ^^^^^^^^^^^^
|
= note: see issue #93333 <https://github.com/rust-lang/rust/issues/93333> for more information
= help: add `#![feature(asm_sym)]` to the crate attributes to enable
error: aborting due to previous error
error[E0658]: sym operands for inline assembly are unstable
--> $DIR/feature-gate-asm_sym.rs:16:29
|
LL | asm!("mov eax, {}", sym foo::<0>);
| ^^^^^^^^^^^^
|
= note: see issue #93333 <https://github.com/rust-lang/rust/issues/93333> for more information
= help: add `#![feature(asm_sym)]` to the crate attributes to enable
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0658`.