Skip to content

Commit c1ec45f

Browse files
committed
rustc_mir: don't use upvar_decls in the generator state transform.
1 parent 82bd719 commit c1ec45f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/librustc_mir/transform/generator.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ fn locals_live_across_suspend_points(
490490

491491
fn compute_layout<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
492492
source: MirSource<'tcx>,
493-
upvars: Vec<Ty<'tcx>>,
493+
upvars: &Vec<Ty<'tcx>>,
494494
interior: Ty<'tcx>,
495495
movable: bool,
496496
mir: &mut Mir<'tcx>)
@@ -505,7 +505,7 @@ fn compute_layout<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
505505
movable);
506506
// Erase regions from the types passed in from typeck so we can compare them with
507507
// MIR types
508-
let allowed_upvars = tcx.erase_regions(&upvars);
508+
let allowed_upvars = tcx.erase_regions(upvars);
509509
let allowed = match interior.sty {
510510
ty::GeneratorWitness(s) => tcx.erase_late_bound_regions(&s),
511511
_ => bug!(),
@@ -528,7 +528,7 @@ fn compute_layout<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
528528
}
529529
}
530530

531-
let upvar_len = mir.upvar_decls.len();
531+
let upvar_len = upvars.len();
532532
let dummy_local = LocalDecl::new_internal(tcx.mk_unit(), mir.span);
533533

534534
// Gather live locals and their indices replacing values in mir.local_decls with a dummy
@@ -917,12 +917,12 @@ impl MirPass for StateTransform {
917917
let (remap, layout, storage_liveness) = compute_layout(
918918
tcx,
919919
source,
920-
upvars,
920+
&upvars,
921921
interior,
922922
movable,
923923
mir);
924924

925-
let state_field = mir.upvar_decls.len();
925+
let state_field = upvars.len();
926926

927927
// Run the transformation which converts Places from Local to generator struct
928928
// accesses for locals in `remap`.

0 commit comments

Comments
 (0)