File tree 1 file changed +31
-0
lines changed
src/test/ui/const-generics/generic_const_exprs
1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change
1
+ // check-pass
2
+
3
+ #![ feature( generic_const_exprs) ]
4
+ #![ allow( incomplete_features) ]
5
+ #![ deny( const_evaluatable_unchecked) ]
6
+
7
+ pub struct If < const CONDITION : bool > ;
8
+ pub trait True { }
9
+ impl True for If < true > { }
10
+
11
+ pub struct FixedI8 < const FRAC : u32 > {
12
+ pub bits : i8 ,
13
+ }
14
+
15
+ impl < const FRAC_LHS : u32 , const FRAC_RHS : u32 > PartialEq < FixedI8 < FRAC_RHS > > for FixedI8 < FRAC_LHS >
16
+ where
17
+ If < { FRAC_RHS <= 8 } > : True ,
18
+ {
19
+ fn eq ( & self , _rhs : & FixedI8 < FRAC_RHS > ) -> bool {
20
+ unimplemented ! ( )
21
+ }
22
+ }
23
+
24
+ impl < const FRAC : u32 > PartialEq < i8 > for FixedI8 < FRAC > {
25
+ fn eq ( & self , rhs : & i8 ) -> bool {
26
+ let rhs_as_fixed = FixedI8 :: < 0 > { bits : * rhs } ;
27
+ PartialEq :: eq ( self , & rhs_as_fixed)
28
+ }
29
+ }
30
+
31
+ fn main ( ) { }
You can’t perform that action at this time.
0 commit comments