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