1 #![feature(const_eval_select)]
3 use std::intrinsics::const_eval_select;
5 const fn not_fn_items() {
6 const_eval_select((), || {}, || {});
7 //~^ ERROR the trait bound
8 const_eval_select((), 42, 0xDEADBEEF);
9 //~^ ERROR the trait bound
10 //~| ERROR expected a `FnOnce<()>` closure
13 const fn foo(n: i32) -> i32 {
17 fn bar(n: i32) -> bool {
18 assert_eq!(n, 0, "{} must be equal to {}", n, 0);
22 fn baz(n: bool) -> i32 {
23 assert!(n, "{} must be true", n);
27 const fn return_ty_mismatch() {
28 const_eval_select((1,), foo, bar);
29 //~^ ERROR type mismatch
32 const fn args_ty_mismatch() {
33 const_eval_select((true,), foo, baz);
34 //~^ ERROR type mismatch