This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +15
-12
lines changed
compiler/rustc_middle/src/ty
tests/ui/const-generics/generic_const_exprs Expand file tree Collapse file tree 2 files changed +15
-12
lines changed Original file line number Diff line number Diff line change @@ -63,7 +63,8 @@ impl<'tcx> TyCtxt<'tcx> {
6363 Err ( e) => self . tcx . const_error_with_guaranteed ( c. ty ( ) , e) ,
6464 Ok ( Some ( bac) ) => {
6565 let substs = self . tcx . erase_regions ( uv. substs ) ;
66- bac. subst ( self . tcx , substs)
66+ let bac = bac. subst ( self . tcx , substs) ;
67+ return bac. fold_with ( self ) ;
6768 }
6869 Ok ( None ) => c,
6970 } ,
Original file line number Diff line number Diff line change 22#![ feature( generic_const_exprs) ]
33#![ allow( incomplete_features, unused_parens, unused_braces) ]
44
5- fn zero_init < const N : usize > ( ) -> Substs1 < { ( N ) } >
5+ fn zero_init < const N : usize > ( ) -> Substs1 < { { N } } >
66where
7- [ u8 ; { ( N ) } ] : ,
7+ [ u8 ; { { N } } ] : ,
88{
9- Substs1 ( [ 0 ; { ( N ) } ] )
9+ Substs1 ( [ 0 ; { { N } } ] )
1010}
1111
12- struct Substs1 < const N : usize > ( [ u8 ; { ( N ) } ] )
12+ struct Substs1 < const N : usize > ( [ u8 ; { { N } } ] )
1313where
14- [ ( ) ; { ( N ) } ] : ;
14+ [ ( ) ; { { N } } ] : ;
1515
16- fn substs2 < const M : usize > ( ) -> Substs1 < { ( M ) } > {
17- zero_init :: < { ( M ) } > ( )
16+ fn substs2 < const M : usize > ( ) -> Substs1 < { { M } } > {
17+ zero_init :: < { { M } } > ( )
1818}
1919
20- fn substs3 < const L : usize > ( ) -> Substs1 < { ( L ) } > {
21- substs2 :: < { ( L ) } > ( )
20+ fn substs3 < const L : usize > ( ) -> Substs1 < { { L } } > {
21+ substs2 :: < { { L } } > ( )
2222}
2323
2424fn main ( ) {
2525 assert_eq ! ( substs3:: <2 >( ) . 0 , [ 0 ; 2 ] ) ;
2626}
2727
28- // Test that the implicit ``{ (L) }`` bound on ``substs3`` satisfies the
29- // ``{ (N) }`` bound on ``Substs1``
28+ // Test that the implicit ``{{ L }}`` bound on ``substs3`` satisfies the
29+ // ``{{ N }}`` bound on ``Substs1``
30+ // FIXME(generic_const_exprs): come up with a less brittle test for this using assoc consts
31+ // once normalization is implemented for them.
You can’t perform that action at this time.
0 commit comments