about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGary Guo <gary@garyguo.net>2025-02-26 17:13:01 +0000
committerGary Guo <gary@garyguo.net>2025-02-26 19:27:19 +0000
commit395b0fb4d9c969b5db0ec1a6b9a0b3203cacbed6 (patch)
treeeb13adaac142ad111b0209d09d4628c9f1184d58
parentf482460f92e8713f701bb3eefcd6866f9b065d39 (diff)
downloadrust-395b0fb4d9c969b5db0ec1a6b9a0b3203cacbed6.tar.gz
rust-395b0fb4d9c969b5db0ec1a6b9a0b3203cacbed6.zip
Bless tests
-rw-r--r--tests/crashes/117877.rs13
-rw-r--r--tests/ui/asm/const-resolve-error.rs10
-rw-r--r--tests/ui/asm/const-resolve-error.stderr14
-rw-r--r--tests/ui/asm/fail-const-eval-issue-121099.rs4
-rw-r--r--tests/ui/asm/fail-const-eval-issue-121099.stderr4
-rw-r--r--tests/ui/asm/invalid-const-operand.stderr2
6 files changed, 29 insertions, 18 deletions
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