Fix SetDiscriminant for generators

This commit is contained in:
bjorn3 2019-06-02 16:25:10 +02:00
parent bd73128d2e
commit 01e9303857

View File

@ -340,9 +340,8 @@ fn trans_stmt<'a, 'tcx: 'a>(
let ptr = place.place_field(fx, mir::Field::new(discr_index));
let to = layout
.ty
.ty_adt_def()
.unwrap()
.discriminant_for_variant(fx.tcx, *variant_index)
.unwrap()
.val;
let discr = CValue::const_val(fx, ptr.layout().ty, to as u64 as i64);
ptr.write_cvalue(fx, discr);