]> git.lizzy.rs Git - rust.git/blob - src/test/ui/intrinsics/const-eval-select.rs
Auto merge of #106025 - matthiaskrgr:rollup-vz5rqah, r=matthiaskrgr
[rust.git] / src / test / ui / intrinsics / const-eval-select.rs
1 // run-pass
2
3 #![feature(const_eval_select)]
4 #![feature(core_intrinsics)]
5
6 use std::intrinsics::const_eval_select;
7
8 const fn yes() -> bool {
9     true
10 }
11
12 fn no() -> bool {
13     false
14 }
15
16 // not a sound use case; testing only
17 const fn is_const_eval() -> bool {
18     unsafe { const_eval_select((), yes, no) }
19 }
20
21 fn main() {
22     const YES: bool = is_const_eval();
23     let no = is_const_eval();
24
25     assert_eq!(true, YES);
26     assert_eq!(false, no);
27 }