File tree 1 file changed +36
-0
lines changed
tests/ui/const-generics/generic_const_exprs
1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change
1
+ //@ check-pass
2
+
3
+ #![ feature( adt_const_params) ]
4
+ #![ feature( generic_const_exprs) ]
5
+ #![ allow( incomplete_features) ]
6
+
7
+ use std:: ops:: Index ;
8
+
9
+ pub struct CellPossibilities ;
10
+
11
+ pub enum CellState < const SQUARE_SIZE : usize > {
12
+ Empty ( Option < CellPossibilities > ) ,
13
+ }
14
+
15
+ pub struct Sudoku < const SQUARE_SIZE : usize > ;
16
+
17
+ impl < const SQUARE_SIZE : usize > Sudoku < SQUARE_SIZE > where
18
+ [ CellState < SQUARE_SIZE > ; SQUARE_SIZE * SQUARE_SIZE ] : Sized ,
19
+ {
20
+ pub fn random ( ) {
21
+ let CellState :: Empty ( _) = Self [ ( ) ] ;
22
+ }
23
+ }
24
+
25
+ impl < const SQUARE_SIZE : usize > Index < ( ) > for Sudoku < SQUARE_SIZE >
26
+ where
27
+ [ CellState < SQUARE_SIZE > ; SQUARE_SIZE * SQUARE_SIZE ] : Sized ,
28
+ {
29
+ type Output = CellState < SQUARE_SIZE > ;
30
+
31
+ fn index ( & self , _: ( ) ) -> & Self :: Output {
32
+ todo ! ( )
33
+ }
34
+ }
35
+
36
+ pub fn main ( ) { }
You can’t perform that action at this time.
0 commit comments