Skip to content

Commit 01e9303

Browse files
committed
Fix SetDiscriminant for generators
1 parent bd73128 commit 01e9303

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/base.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -340,9 +340,8 @@ fn trans_stmt<'a, 'tcx: 'a>(
340340
let ptr = place.place_field(fx, mir::Field::new(discr_index));
341341
let to = layout
342342
.ty
343-
.ty_adt_def()
344-
.unwrap()
345343
.discriminant_for_variant(fx.tcx, *variant_index)
344+
.unwrap()
346345
.val;
347346
let discr = CValue::const_val(fx, ptr.layout().ty, to as u64 as i64);
348347
ptr.write_cvalue(fx, discr);

0 commit comments

Comments
 (0)