]>
git.proxmox.com Git - rustc.git/blob - src/test/ui/const-generics/const_evaluatable_checked/abstract-const-as-cast-3.rs
1 #![feature(const_generics, const_evaluatable_checked)]
2 #![allow(incomplete_features)]
5 pub struct EvaluatableU128
<const N
: u128
>;
7 struct HasCastInTraitImpl
<const N
: usize, const M
: u128
>;
8 impl<const O
: usize> Trait
for HasCastInTraitImpl
<O
, { O as u128 }
> {}
10 pub fn use_trait_impl
<const N
: usize>()
13 EvaluatableU128
<{N as u128}
>:, {
14 fn assert_impl
<T
: Trait
>() {}
16 // errors are bad but seems to be pre-existing issue #86198
17 assert_impl
::<HasCastInTraitImpl
<{ N + 1 }
, { N as u128 }
>>();
18 //~^ Error: mismatched types
19 //~^^ Error: unconstrained generic constant
20 assert_impl
::<HasCastInTraitImpl
<{ N + 1 }
, { N as _ }
>>();
21 //~^ Error: mismatched types
22 //~^^ Error: unconstrained generic constant
23 assert_impl
::<HasCastInTraitImpl
<13, { 12 as u128 }
>>();
24 //~^ Error: mismatched types
25 assert_impl
::<HasCastInTraitImpl
<14, 13>>();
26 //~^ Error: mismatched types
28 pub fn use_trait_impl_2
<const N
: usize>()
31 EvaluatableU128
<{N as _}
>:, {
32 fn assert_impl
<T
: Trait
>() {}
34 // errors are bad but seems to be pre-existing issue #86198
35 assert_impl
::<HasCastInTraitImpl
<{ N + 1 }
, { N as u128 }
>>();
36 //~^ Error: mismatched types
37 //~^^ Error: unconstrained generic constant
38 assert_impl
::<HasCastInTraitImpl
<{ N + 1 }
, { N as _ }
>>();
39 //~^ Error: mismatched types
40 //~^^ Error: unconstrained generic constant
41 assert_impl
::<HasCastInTraitImpl
<13, { 12 as u128 }
>>();
42 //~^ Error: mismatched types
43 assert_impl
::<HasCastInTraitImpl
<14, 13>>();
44 //~^ Error: mismatched types