2022-02-09 12:53:40 -06:00
|
|
|
#![feature(generic_const_exprs)]
|
2021-12-08 16:25:52 -06:00
|
|
|
#![allow(incomplete_features)]
|
|
|
|
|
|
|
|
trait MiniTypeId {
|
|
|
|
const TYPE_ID: u64;
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<T> MiniTypeId for T {
|
|
|
|
const TYPE_ID: u64 = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
enum Lift<const V: bool> {}
|
|
|
|
|
|
|
|
trait IsFalse {}
|
|
|
|
impl IsFalse for Lift<false> {}
|
|
|
|
|
|
|
|
const fn is_same_type<T: MiniTypeId, U: MiniTypeId>() -> bool {
|
|
|
|
T::TYPE_ID == U::TYPE_ID
|
|
|
|
}
|
|
|
|
|
|
|
|
fn requires_distinct<A, B>(_a: A, _b: B) where
|
|
|
|
A: MiniTypeId, B: MiniTypeId,
|
|
|
|
Lift<{is_same_type::<A, B>()}>: IsFalse {}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
requires_distinct("str", 12);
|
|
|
|
//~^ ERROR mismatched types
|
|
|
|
}
|