From 395b0fb4d9c969b5db0ec1a6b9a0b3203cacbed6 Mon Sep 17 00:00:00 2001 From: Gary Guo Date: Wed, 26 Feb 2025 17:13:01 +0000 Subject: [PATCH] Bless tests --- tests/crashes/117877.rs | 13 ------------- tests/ui/asm/const-resolve-error.rs | 10 ++++++++++ tests/ui/asm/const-resolve-error.stderr | 14 ++++++++++++++ tests/ui/asm/fail-const-eval-issue-121099.rs | 4 ++-- tests/ui/asm/fail-const-eval-issue-121099.stderr | 4 ++-- tests/ui/asm/invalid-const-operand.stderr | 2 +- 6 files changed, 29 insertions(+), 18 deletions(-) delete mode 100644 tests/crashes/117877.rs create mode 100644 tests/ui/asm/const-resolve-error.rs create mode 100644 tests/ui/asm/const-resolve-error.stderr diff --git a/tests/crashes/117877.rs b/tests/crashes/117877.rs deleted file mode 100644 index b1effc0cbcb..00000000000 --- a/tests/crashes/117877.rs +++ /dev/null @@ -1,13 +0,0 @@ -//@ known-bug: #117877 -//@ edition:2021 -//@ needs-rustc-debug-assertions -//@ only-x86_64 -#![feature(asm_const)] - -use std::arch::asm; - -async unsafe fn foo<'a>() { - asm!("/* {0} */", const N); -} - -fn main() {} diff --git a/tests/ui/asm/const-resolve-error.rs b/tests/ui/asm/const-resolve-error.rs new file mode 100644 index 00000000000..19c8af0d542 --- /dev/null +++ b/tests/ui/asm/const-resolve-error.rs @@ -0,0 +1,10 @@ +//@ edition:2021 +//@ needs-asm-support + +use std::arch::asm; + +async unsafe fn foo<'a>() { + asm!("/* {0} */", const N); //~ ERROR E0425 +} + +fn main() {} diff --git a/tests/ui/asm/const-resolve-error.stderr b/tests/ui/asm/const-resolve-error.stderr new file mode 100644 index 00000000000..f02a7f0a6b1 --- /dev/null +++ b/tests/ui/asm/const-resolve-error.stderr @@ -0,0 +1,14 @@ +error[E0425]: cannot find value `N` in this scope + --> $DIR/const-resolve-error.rs:7:29 + | +LL | asm!("/* {0} */", const N); + | ^ not found in this scope + | +help: you might be missing a const parameter + | +LL | async unsafe fn foo<'a, const N: /* Type */>() { + | +++++++++++++++++++++ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0425`. diff --git a/tests/ui/asm/fail-const-eval-issue-121099.rs b/tests/ui/asm/fail-const-eval-issue-121099.rs index 36d00b1e5d2..c91bbfd1b73 100644 --- a/tests/ui/asm/fail-const-eval-issue-121099.rs +++ b/tests/ui/asm/fail-const-eval-issue-121099.rs @@ -5,6 +5,6 @@ use std::arch::global_asm; fn main() {} -global_asm!("/* {} */", const 1 << 500); //~ ERROR evaluation of constant value failed [E0080] +global_asm!("/* {} */", const 1 << 500); //~ ERROR E0080 -global_asm!("/* {} */", const 1 / 0); //~ ERROR evaluation of constant value failed [E0080] +global_asm!("/* {} */", const 1 / 0); //~ ERROR E0080 diff --git a/tests/ui/asm/fail-const-eval-issue-121099.stderr b/tests/ui/asm/fail-const-eval-issue-121099.stderr index 5d86c3a5f7b..eb662dadffb 100644 --- a/tests/ui/asm/fail-const-eval-issue-121099.stderr +++ b/tests/ui/asm/fail-const-eval-issue-121099.stderr @@ -1,10 +1,10 @@ -error[E0080]: evaluation of constant value failed +error[E0080]: evaluation of `{global_asm#0}::{constant#0}` failed --> $DIR/fail-const-eval-issue-121099.rs:8:31 | LL | global_asm!("/* {} */", const 1 << 500); | ^^^^^^^^ attempt to shift left by `500_i32`, which would overflow -error[E0080]: evaluation of constant value failed +error[E0080]: evaluation of `{global_asm#1}::{constant#0}` failed --> $DIR/fail-const-eval-issue-121099.rs:10:31 | LL | global_asm!("/* {} */", const 1 / 0); diff --git a/tests/ui/asm/invalid-const-operand.stderr b/tests/ui/asm/invalid-const-operand.stderr index 13bb10e84a5..1cedabeef28 100644 --- a/tests/ui/asm/invalid-const-operand.stderr +++ b/tests/ui/asm/invalid-const-operand.stderr @@ -80,7 +80,7 @@ error: invalid type for `const` operand LL | asm!("{}", const &0); | ^^^^^^-- | | - | is a `&i32` + | is a `&{integer}` | = help: `const` operands must be of an integer type