}
}
-fn make_generator_state_argument_indirect<'tcx>(tcx: TyCtxt<'tcx>, body: &mut BodyAndCache<'tcx>) {
+fn make_generator_state_argument_indirect<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
let gen_ty = body.local_decls.raw[1].ty;
let ref_gen_ty =
DerefArgVisitor { tcx }.visit_body(body);
}
-fn make_generator_state_argument_pinned<'tcx>(tcx: TyCtxt<'tcx>, body: &mut BodyAndCache<'tcx>) {
+fn make_generator_state_argument_pinned<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
let ref_gen_ty = body.local_decls.raw[1].ty;
let pin_did = tcx.lang_items().pin_type().unwrap();
fn replace_local<'tcx>(
local: Local,
ty: Ty<'tcx>,
- body: &mut BodyAndCache<'tcx>,
+ body: &mut Body<'tcx>,
tcx: TyCtxt<'tcx>,
) -> Local {
let source_info = source_info(body);
fn locals_live_across_suspend_points(
tcx: TyCtxt<'tcx>,
- body: ReadOnlyBodyAndCache<'_, 'tcx>,
+ body: &Body<'tcx>,
source: MirSource<'tcx>,
always_live_locals: &storage::AlwaysLiveLocals,
movable: bool,
interior: Ty<'tcx>,
always_live_locals: &storage::AlwaysLiveLocals,
movable: bool,
- body: &mut BodyAndCache<'tcx>,
+ body: &mut Body<'tcx>,
) -> (
FxHashMap<Local, (Ty<'tcx>, VariantIdx, usize)>,
GeneratorLayout<'tcx>,
live_locals_at_suspension_points,
storage_conflicts,
storage_liveness,
- } = locals_live_across_suspend_points(
- tcx,
- read_only!(body),
- source,
- always_live_locals,
- movable,
- );
+ } = locals_live_across_suspend_points(tcx, body, source, always_live_locals, movable);
// Erase regions from the types passed in from typeck so we can compare them with
// MIR types
///
/// After this function, the former entry point of the function will be bb1.
fn insert_switch<'tcx>(
- body: &mut BodyAndCache<'tcx>,
+ body: &mut Body<'tcx>,
cases: Vec<(usize, BasicBlock)>,
transform: &TransformVisitor<'tcx>,
default: TerminatorKind<'tcx>,
}
}
-fn elaborate_generator_drops<'tcx>(
- tcx: TyCtxt<'tcx>,
- def_id: DefId,
- body: &mut BodyAndCache<'tcx>,
-) {
+fn elaborate_generator_drops<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId, body: &mut Body<'tcx>) {
use crate::shim::DropShimElaborator;
use crate::util::elaborate_drops::{elaborate_drop, Unwind};
use crate::util::patch::MirPatch;
transform: &TransformVisitor<'tcx>,
source: MirSource<'tcx>,
gen_ty: Ty<'tcx>,
- body: &mut BodyAndCache<'tcx>,
+ body: &mut Body<'tcx>,
drop_clean: BasicBlock,
-) -> BodyAndCache<'tcx> {
+) -> Body<'tcx> {
let mut body = body.clone();
body.arg_count = 1; // make sure the resume argument is not included here
body
}
-fn insert_term_block<'tcx>(
- body: &mut BodyAndCache<'tcx>,
- kind: TerminatorKind<'tcx>,
-) -> BasicBlock {
+fn insert_term_block<'tcx>(body: &mut Body<'tcx>, kind: TerminatorKind<'tcx>) -> BasicBlock {
let term_block = BasicBlock::new(body.basic_blocks().len());
let source_info = source_info(body);
body.basic_blocks_mut().push(BasicBlockData {
fn insert_panic_block<'tcx>(
tcx: TyCtxt<'tcx>,
- body: &mut BodyAndCache<'tcx>,
+ body: &mut Body<'tcx>,
message: AssertMessage<'tcx>,
) -> BasicBlock {
let assert_block = BasicBlock::new(body.basic_blocks().len());
tcx: TyCtxt<'tcx>,
transform: TransformVisitor<'tcx>,
source: MirSource<'tcx>,
- body: &mut BodyAndCache<'tcx>,
+ body: &mut Body<'tcx>,
can_return: bool,
) {
let can_unwind = can_unwind(tcx, body);
SourceInfo { span: body.span, scope: OUTERMOST_SOURCE_SCOPE }
}
-fn insert_clean_drop(body: &mut BodyAndCache<'_>) -> BasicBlock {
+fn insert_clean_drop(body: &mut Body<'_>) -> BasicBlock {
let return_block = insert_term_block(body, TerminatorKind::Return);
// Create a block to destroy an unresumed generators. This can only destroy upvars.
}
fn create_cases<'tcx>(
- body: &mut BodyAndCache<'tcx>,
+ body: &mut Body<'tcx>,
transform: &TransformVisitor<'tcx>,
operation: Operation,
) -> Vec<(usize, BasicBlock)> {
}
impl<'tcx> MirPass<'tcx> for StateTransform {
- fn run_pass(&self, tcx: TyCtxt<'tcx>, source: MirSource<'tcx>, body: &mut BodyAndCache<'tcx>) {
+ fn run_pass(&self, tcx: TyCtxt<'tcx>, source: MirSource<'tcx>, body: &mut Body<'tcx>) {
let yield_ty = if let Some(yield_ty) = body.yield_ty {
yield_ty
} else {