File tree Expand file tree Collapse file tree 2 files changed +32
-4
lines changed
compiler/rustc_mir_transform/src Expand file tree Collapse file tree 2 files changed +32
-4
lines changed Original file line number Diff line number Diff line change @@ -726,9 +726,13 @@ fn sanitize_witness<'tcx>(
726726 saved_locals : & GeneratorSavedLocals ,
727727) {
728728 let did = body. source . def_id ( ) ;
729- let allowed_upvars = tcx. erase_regions ( upvars) ;
729+ let param_env = tcx. param_env ( did) ;
730+
731+ let allowed_upvars = tcx. normalize_erasing_regions ( param_env, upvars) ;
730732 let allowed = match witness. kind ( ) {
731- & ty:: GeneratorWitness ( s) => tcx. erase_late_bound_regions ( s) ,
733+ & ty:: GeneratorWitness ( interior_tys) => {
734+ tcx. normalize_erasing_late_bound_regions ( param_env, interior_tys)
735+ }
732736 _ => {
733737 tcx. sess . delay_span_bug (
734738 body. span ,
@@ -738,8 +742,6 @@ fn sanitize_witness<'tcx>(
738742 }
739743 } ;
740744
741- let param_env = tcx. param_env ( did) ;
742-
743745 for ( local, decl) in body. local_decls . iter_enumerated ( ) {
744746 // Ignore locals which are internal or not saved between yields.
745747 if !saved_locals. contains ( local) || decl. internal {
Original file line number Diff line number Diff line change 1+ // edition:2018
2+ // run-pass
3+
4+ #![ allow( incomplete_features) ]
5+ #![ feature( generic_const_exprs) ]
6+ #![ allow( unused) ]
7+
8+ fn main ( ) {
9+ let x = test ( ) ;
10+ }
11+
12+ fn concat < const A : usize , const B : usize > ( a : [ f32 ; A ] , b : [ f32 ; B ] ) -> [ f32 ; A + B ] {
13+ todo ! ( )
14+ }
15+
16+ async fn reverse < const A : usize > ( x : [ f32 ; A ] ) -> [ f32 ; A ] {
17+ todo ! ( )
18+ }
19+
20+ async fn test ( ) {
21+ let a = [ 0.0 ] ;
22+ let b = [ 1.0 , 2.0 ] ;
23+ let ab = concat ( a, b) ;
24+ let ba = reverse ( ab) . await ;
25+ println ! ( "{:?}" , ba) ;
26+ }
You can’t perform that action at this time.
0 commit comments