]> git.lizzy.rs Git - rust.git/blob - tests/ui/const-generics/issues/issue-79674.rs
Rollup merge of #106427 - mejrs:translation_errors, r=davidtwco
[rust.git] / tests / ui / const-generics / issues / issue-79674.rs
1 #![feature(generic_const_exprs)]
2 #![allow(incomplete_features)]
3
4 trait MiniTypeId {
5     const TYPE_ID: u64;
6 }
7
8 impl<T> MiniTypeId for T {
9     const TYPE_ID: u64 = 0;
10 }
11
12 enum Lift<const V: bool> {}
13
14 trait IsFalse {}
15 impl IsFalse for Lift<false> {}
16
17 const fn is_same_type<T: MiniTypeId, U: MiniTypeId>() -> bool {
18     T::TYPE_ID == U::TYPE_ID
19 }
20
21 fn requires_distinct<A, B>(_a: A, _b: B) where
22     A: MiniTypeId, B: MiniTypeId,
23     Lift<{is_same_type::<A, B>()}>: IsFalse {}
24
25 fn main() {
26     requires_distinct("str", 12);
27     //~^ ERROR mismatched types
28 }