1
Fork 0

Bless tests

This commit is contained in:
Gary Guo 2025-02-26 17:13:01 +00:00
parent f482460f92
commit 395b0fb4d9
6 changed files with 29 additions and 18 deletions

View file

@ -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() {}

View file

@ -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`.

View file

@ -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

View file

@ -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);

View file

@ -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