Skip to content

Commit 9e04ab9

Browse files
interpret direct field access to coroutine state as upvar access
1 parent 661274f commit 9e04ab9

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

compiler/rustc_codegen_ssa/src/mir/operand.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -701,13 +701,12 @@ impl<'a, 'tcx, V: CodegenObject> OperandValue<V> {
701701
}
702702

703703
impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
704+
#[instrument(level = "debug", skip(self, bx), ret)]
704705
fn maybe_codegen_consume_direct(
705706
&mut self,
706707
bx: &mut Bx,
707708
place_ref: mir::PlaceRef<'tcx>,
708709
) -> Option<OperandRef<'tcx, Bx::Value>> {
709-
debug!("maybe_codegen_consume_direct(place_ref={:?})", place_ref);
710-
711710
match self.locals[place_ref.local] {
712711
LocalRef::Operand(mut o) => {
713712
// Moves out of scalar and scalar pair fields are trivial.
@@ -750,13 +749,12 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
750749
}
751750
}
752751

752+
#[instrument(level = "debug", skip(self, bx), ret)]
753753
pub fn codegen_consume(
754754
&mut self,
755755
bx: &mut Bx,
756756
place_ref: mir::PlaceRef<'tcx>,
757757
) -> OperandRef<'tcx, Bx::Value> {
758-
debug!("codegen_consume(place_ref={:?})", place_ref);
759-
760758
let ty = self.monomorphized_place_ty(place_ref);
761759
let layout = bx.cx().layout_of(ty);
762760

@@ -775,13 +773,12 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
775773
bx.load_operand(place)
776774
}
777775

776+
#[instrument(level = "debug", skip(self, bx), ret)]
778777
pub fn codegen_operand(
779778
&mut self,
780779
bx: &mut Bx,
781780
operand: &mir::Operand<'tcx>,
782781
) -> OperandRef<'tcx, Bx::Value> {
783-
debug!("codegen_operand(operand={:?})", operand);
784-
785782
match *operand {
786783
mir::Operand::Copy(ref place) | mir::Operand::Move(ref place) => {
787784
self.codegen_consume(bx, place.as_ref())

compiler/rustc_const_eval/src/interpret/step.rs

+3
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,9 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
305305
let variant_dest = self.project_downcast(dest, variant_index)?;
306306
(variant_index, variant_dest, active_field_index)
307307
}
308+
mir::AggregateKind::Coroutine(_def_id, _args) => {
309+
(FIRST_VARIANT, self.project_downcast(dest, FIRST_VARIANT)?, None)
310+
}
308311
mir::AggregateKind::RawPtr(..) => {
309312
// Pointers don't have "fields" in the normal sense, so the
310313
// projection-based code below would either fail in projection

0 commit comments

Comments
 (0)