From 441d98f1a426109dd4aecd4d214f7c4925c95aa3 Mon Sep 17 00:00:00 2001 From: Gary Guo Date: Tue, 10 May 2022 22:02:37 +0100 Subject: [PATCH] Expand feature gate testing for asm_const/asm_sym --- .../ui/feature-gates/feature-gate-asm_const.rs | 6 ++++++ .../feature-gates/feature-gate-asm_const.stderr | 13 +++++++++++-- .../ui/feature-gates/feature-gate-asm_sym.rs | 13 +++++++++++-- .../feature-gates/feature-gate-asm_sym.stderr | 17 +++++++++++++---- 4 files changed, 41 insertions(+), 8 deletions(-) diff --git a/src/test/ui/feature-gates/feature-gate-asm_const.rs b/src/test/ui/feature-gates/feature-gate-asm_const.rs index d41d7b258aa..936918a3cfc 100644 --- a/src/test/ui/feature-gates/feature-gate-asm_const.rs +++ b/src/test/ui/feature-gates/feature-gate-asm_const.rs @@ -2,8 +2,14 @@ use std::arch::asm; +unsafe fn foo() { + 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 } diff --git a/src/test/ui/feature-gates/feature-gate-asm_const.stderr b/src/test/ui/feature-gates/feature-gate-asm_const.stderr index 0202ccbe5a2..c248374ec49 100644 --- a/src/test/ui/feature-gates/feature-gate-asm_const.stderr +++ b/src/test/ui/feature-gates/feature-gate-asm_const.stderr @@ -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 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 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`. diff --git a/src/test/ui/feature-gates/feature-gate-asm_sym.rs b/src/test/ui/feature-gates/feature-gate-asm_sym.rs index e4d781c6859..0de6b3abb18 100644 --- a/src/test/ui/feature-gates/feature-gate-asm_sym.rs +++ b/src/test/ui/feature-gates/feature-gate-asm_sym.rs @@ -2,9 +2,18 @@ use std::arch::asm; -fn main() { +fn bar() {} + +fn foo() { unsafe { - asm!("mov eax, {}", sym main); + asm!("mov eax, {}", sym bar::); + //~^ 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 } } diff --git a/src/test/ui/feature-gates/feature-gate-asm_sym.stderr b/src/test/ui/feature-gates/feature-gate-asm_sym.stderr index 68f2d0f6c18..d4b16f60b0b 100644 --- a/src/test/ui/feature-gates/feature-gate-asm_sym.stderr +++ b/src/test/ui/feature-gates/feature-gate-asm_sym.stderr @@ -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::); + | ^^^^^^^^^^^^ | = note: see issue #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 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`.