Skip to content

Commit 17cc4b7

Browse files
interpret direct field access to coroutine state as upvar access
1 parent 8c09f2f commit 17cc4b7

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

compiler/rustc_codegen_ssa/src/mir/operand.rs

+4-7
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use rustc_middle::mir::{self, ConstValue};
99
use rustc_middle::ty::Ty;
1010
use rustc_middle::ty::layout::{LayoutOf, TyAndLayout};
1111
use rustc_middle::{bug, span_bug};
12-
use tracing::debug;
12+
use tracing::{debug, instrument};
1313

1414
use super::place::{PlaceRef, PlaceValue};
1515
use super::{FunctionCx, LocalRef};
@@ -557,13 +557,12 @@ impl<'a, 'tcx, V: CodegenObject> OperandValue<V> {
557557
}
558558

559559
impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
560+
#[instrument(level = "debug", skip(self, bx), ret)]
560561
fn maybe_codegen_consume_direct(
561562
&mut self,
562563
bx: &mut Bx,
563564
place_ref: mir::PlaceRef<'tcx>,
564565
) -> Option<OperandRef<'tcx, Bx::Value>> {
565-
debug!("maybe_codegen_consume_direct(place_ref={:?})", place_ref);
566-
567566
match self.locals[place_ref.local] {
568567
LocalRef::Operand(mut o) => {
569568
// Moves out of scalar and scalar pair fields are trivial.
@@ -606,13 +605,12 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
606605
}
607606
}
608607

608+
#[instrument(level = "debug", skip(self, bx), ret)]
609609
pub fn codegen_consume(
610610
&mut self,
611611
bx: &mut Bx,
612612
place_ref: mir::PlaceRef<'tcx>,
613613
) -> OperandRef<'tcx, Bx::Value> {
614-
debug!("codegen_consume(place_ref={:?})", place_ref);
615-
616614
let ty = self.monomorphized_place_ty(place_ref);
617615
let layout = bx.cx().layout_of(ty);
618616

@@ -631,13 +629,12 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
631629
bx.load_operand(place)
632630
}
633631

632+
#[instrument(level = "debug", skip(self, bx), ret)]
634633
pub fn codegen_operand(
635634
&mut self,
636635
bx: &mut Bx,
637636
operand: &mir::Operand<'tcx>,
638637
) -> OperandRef<'tcx, Bx::Value> {
639-
debug!("codegen_operand(operand={:?})", operand);
640-
641638
match *operand {
642639
mir::Operand::Copy(ref place) | mir::Operand::Move(ref place) => {
643640
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)