File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed
src/test/ui/const-generics/issues Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ // Regression test for #84408.
2+ // check-pass
3+
4+ #![ feature( const_generics, const_evaluatable_checked) ]
5+ #![ allow( incomplete_features) ]
6+
7+ trait Melon < const X : usize > {
8+ fn new ( arr : [ i32 ; X ] ) -> Self ;
9+ fn change < T : Melon < X > > ( self ) -> T ;
10+ }
11+
12+ struct Foo ( [ i32 ; 5 ] ) ;
13+ struct Bar < const A : usize , const B : usize > ( [ i32 ; A + B ] )
14+ where
15+ [ ( ) ; A + B ] : ;
16+
17+ impl Melon < 5 > for Foo {
18+ fn new ( arr : [ i32 ; 5 ] ) -> Self {
19+ Foo ( arr)
20+ }
21+ fn change < T : Melon < 5 > > ( self ) -> T {
22+ T :: new ( self . 0 )
23+ }
24+ }
25+
26+ impl < const A : usize , const B : usize > Melon < { A + B } > for Bar < A , B >
27+ where
28+ [ ( ) ; A + B ] : ,
29+ {
30+ fn new ( arr : [ i32 ; A + B ] ) -> Self {
31+ Bar ( arr)
32+ }
33+ fn change < T : Melon < { A + B } > > ( self ) -> T {
34+ T :: new ( self . 0 )
35+ }
36+ }
37+
38+ fn main ( ) { }
You can’t perform that action at this time.
0 commit comments