mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-02 15:32:06 +00:00
5a4561749a
Fix overflow check Make MIRI choose the path randomly and rename the intrinsic Add back test Add miri test and make it operate on `ptr` Define `llvm.is.constant` for primitives Update MIRI comment and fix test in stage2 Add const eval test Clarify that both branches must have the same side effects guaranteed non guarantee use immediate type instead Co-Authored-By: Ralf Jung <post@ralfj.de>
16 lines
360 B
Rust
16 lines
360 B
Rust
// run-pass
|
|
|
|
#![feature(core_intrinsics)]
|
|
#![feature(is_val_statically_known)]
|
|
|
|
use std::intrinsics::is_val_statically_known;
|
|
|
|
const CONST_TEST: bool = unsafe { is_val_statically_known(0) };
|
|
|
|
fn main() {
|
|
if CONST_TEST {
|
|
unreachable!("currently expected to return false during const eval");
|
|
// but note that this is not a guarantee!
|
|
}
|
|
}
|