Skip to content

Commit 935842b

Browse files
Add tests
1 parent 3cdcdaf commit 935842b

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
//@ build-fail
2+
#![feature(asm_const)]
3+
4+
use std::arch::global_asm;
5+
6+
fn main() {}
7+
8+
global_asm!("/* {} */", const 1 << 500); //~ ERROR evaluation of constant value failed [E0080]
9+
10+
global_asm!("/* {} */", const 1 / 0); //~ ERROR evaluation of constant value failed [E0080]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
error[E0080]: evaluation of constant value failed
2+
--> $DIR/fail-const-eval-issue-121099.rs:8:31
3+
|
4+
LL | global_asm!("/* {} */", const 1 << 500);
5+
| ^^^^^^^^ attempt to shift left by `500_i32`, which would overflow
6+
7+
error[E0080]: evaluation of constant value failed
8+
--> $DIR/fail-const-eval-issue-121099.rs:10:31
9+
|
10+
LL | global_asm!("/* {} */", const 1 / 0);
11+
| ^^^^^ attempt to divide `1_i32` by zero
12+
13+
error: aborting due to 2 previous errors
14+
15+
For more information about this error, try `rustc --explain E0080`.

0 commit comments

Comments
 (0)