Skip to content

Commit

Permalink
Expand feature gate testing for asm_const/asm_sym
Browse files Browse the repository at this point in the history
  • Loading branch information
nbdd0121 committed May 10, 2022
1 parent b1c6c06 commit 441d98f
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 7 deletions.
6 changes: 6 additions & 0 deletions src/test/ui/feature-gates/feature-gate-asm_const.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
13 changes: 11 additions & 2 deletions src/test/ui/feature-gates/feature-gate-asm_const.stderr
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
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);
| ^^^^^^^^^
|
= 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`.
11 changes: 10 additions & 1 deletion src/test/ui/feature-gates/feature-gate-asm_sym.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,18 @@

use std::arch::asm;

fn bar<const N: usize>() {}

fn foo<const N: usize>() {
unsafe {
asm!("mov eax, {}", sym bar::<N>);
//~^ ERROR sym operands for inline assembly are unstable
}
}

fn main() {
unsafe {
asm!("mov eax, {}", sym main);
asm!("mov eax, {}", sym foo::<0>);
//~^ ERROR sym operands for inline assembly are unstable
}
}
17 changes: 13 additions & 4 deletions src/test/ui/feature-gates/feature-gate-asm_sym.stderr
Original file line number Diff line number Diff line change
@@ -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`.

0 comments on commit 441d98f

Please sign in to comment.