2021-12-08 16:25:52 -06:00
|
|
|
#![feature(const_type_id)]
|
|
|
|
#![feature(generic_const_exprs)]
|
|
|
|
#![feature(core_intrinsics)]
|
|
|
|
#![allow(incomplete_features)]
|
|
|
|
|
|
|
|
use std::any::TypeId;
|
|
|
|
|
|
|
|
struct If<const B: bool>;
|
|
|
|
pub trait True {}
|
|
|
|
impl True for If<true> {}
|
|
|
|
|
|
|
|
fn consume<T: 'static>(_val: T)
|
|
|
|
where
|
|
|
|
If<{ TypeId::of::<T>() != TypeId::of::<()>() }>: True,
|
2023-01-16 14:26:03 -06:00
|
|
|
//~^ overly complex generic constant
|
2024-02-01 16:45:00 -06:00
|
|
|
//~| ERROR: cannot call
|
2021-12-08 16:25:52 -06:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
fn test<T: 'static>()
|
|
|
|
where
|
|
|
|
If<{ TypeId::of::<T>() != TypeId::of::<()>() }>: True,
|
2023-01-16 14:26:03 -06:00
|
|
|
//~^ overly complex generic constant
|
2024-02-01 16:45:00 -06:00
|
|
|
//~| ERROR: cannot call
|
2021-12-08 16:25:52 -06:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let a = ();
|
|
|
|
consume(0i32);
|
|
|
|
consume(a);
|
|
|
|
}
|