2 use rustc::hir::def_id::DefId;
4 use rustc::ty::{self, Ty, TyCtxt};
5 use rustc::ty::layout::VariantIdx;
6 use rustc::ty::subst::{Subst, InternalSubsts};
7 use rustc::ty::query::Providers;
9 use rustc_index::vec::{IndexVec, Idx};
11 use rustc_target::spec::abi::Abi;
12 use syntax_pos::{Span, sym};
17 use crate::transform::{
18 add_moves_for_packed_drops, add_call_guards,
19 remove_noop_landing_pads, no_landing_pads, simplify, run_passes
21 use crate::util::elaborate_drops::{self, DropElaborator, DropStyle, DropFlagMode};
22 use crate::util::patch::MirPatch;
23 use crate::util::expand_aggregate;
25 pub fn provide(providers: &mut Providers<'_>) {
26 providers.mir_shims = make_shim;
29 fn make_shim<'tcx>(tcx: TyCtxt<'tcx>, instance: ty::InstanceDef<'tcx>) -> &'tcx Body<'tcx> {
30 debug!("make_shim({:?})", instance);
32 let mut result = match instance {
33 ty::InstanceDef::Item(..) =>
34 bug!("item {:?} passed to make_shim", instance),
35 ty::InstanceDef::VtableShim(def_id) => {
39 Adjustment::DerefMove,
40 CallKind::Direct(def_id),
44 ty::InstanceDef::FnPtrShim(def_id, ty) => {
45 let trait_ = tcx.trait_of_item(def_id).unwrap();
46 let adjustment = match tcx.lang_items().fn_trait_kind(trait_) {
47 Some(ty::ClosureKind::FnOnce) => Adjustment::Identity,
48 Some(ty::ClosureKind::FnMut) |
49 Some(ty::ClosureKind::Fn) => Adjustment::Deref,
50 None => bug!("fn pointer {:?} is not an fn", ty)
52 // HACK: we need the "real" argument types for the MIR,
53 // but because our substs are (Self, Args), where Args
54 // is a tuple, we must include the *concrete* argument
55 // types in the MIR. They will be substituted again with
56 // the param-substs, but because they are concrete, this
57 // will not do any harm.
58 let sig = tcx.erase_late_bound_regions(&ty.fn_sig(tcx));
59 let arg_tys = sig.inputs();
69 // We are generating a call back to our def-id, which the
70 // codegen backend knows to turn to an actual virtual call.
71 ty::InstanceDef::Virtual(def_id, _) |
72 // ...or we are generating a direct call to a function for which indirect calls must be
73 // codegen'd differently than direct ones (example: #[track_caller])
74 ty::InstanceDef::ReifyShim(def_id) => {
79 CallKind::Direct(def_id),
83 ty::InstanceDef::ClosureOnceShim { call_once } => {
84 let fn_mut = tcx.lang_items().fn_mut_trait().unwrap();
86 .associated_items(fn_mut)
87 .find(|it| it.kind == ty::AssocKind::Method)
94 CallKind::Direct(call_mut),
98 ty::InstanceDef::DropGlue(def_id, ty) => {
99 build_drop_shim(tcx, def_id, ty)
101 ty::InstanceDef::CloneShim(def_id, ty) => {
102 let name = tcx.item_name(def_id);
103 if name == sym::clone {
104 build_clone_shim(tcx, def_id, ty)
105 } else if name == sym::clone_from {
106 debug!("make_shim({:?}: using default trait implementation", instance);
107 return tcx.optimized_mir(def_id);
109 bug!("builtin clone shim {:?} not supported", instance)
112 ty::InstanceDef::Intrinsic(_) => {
113 bug!("creating shims from intrinsics ({:?}) is unsupported", instance)
116 debug!("make_shim({:?}) = untransformed {:?}", instance, result);
118 run_passes(tcx, &mut result, instance, None, MirPhase::Const, &[
119 &add_moves_for_packed_drops::AddMovesForPackedDrops,
120 &no_landing_pads::NoLandingPads::new(tcx),
121 &remove_noop_landing_pads::RemoveNoopLandingPads,
122 &simplify::SimplifyCfg::new("make_shim"),
123 &add_call_guards::CriticalCallEdges,
126 debug!("make_shim({:?}) = {:?}", instance, result);
128 tcx.arena.alloc(result)
131 #[derive(Copy, Clone, Debug, PartialEq)]
139 #[derive(Copy, Clone, Debug, PartialEq)]
145 fn temp_decl(mutability: Mutability, ty: Ty<'_>, span: Span) -> LocalDecl<'_> {
146 let source_info = SourceInfo { scope: OUTERMOST_SOURCE_SCOPE, span };
150 user_ty: UserTypeProjections::none(),
153 local_info: LocalInfo::Other,
158 fn local_decls_for_sig<'tcx>(sig: &ty::FnSig<'tcx>, span: Span)
159 -> IndexVec<Local, LocalDecl<'tcx>>
161 iter::once(temp_decl(Mutability::Mut, sig.output(), span))
162 .chain(sig.inputs().iter().map(
163 |ity| temp_decl(Mutability::Not, ity, span)))
167 fn build_drop_shim<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId, ty: Option<Ty<'tcx>>) -> Body<'tcx> {
168 debug!("build_drop_shim(def_id={:?}, ty={:?})", def_id, ty);
170 // Check if this is a generator, if so, return the drop glue for it
171 if let Some(&ty::TyS { kind: ty::Generator(gen_def_id, substs, _), .. }) = ty {
172 let body = &**tcx.optimized_mir(gen_def_id).generator_drop.as_ref().unwrap();
173 return body.subst(tcx, substs);
176 let substs = if let Some(ty) = ty {
177 tcx.intern_substs(&[ty.into()])
179 InternalSubsts::identity_for_item(tcx, def_id)
181 let sig = tcx.fn_sig(def_id).subst(tcx, substs);
182 let sig = tcx.erase_late_bound_regions(&sig);
183 let span = tcx.def_span(def_id);
185 let source_info = SourceInfo { span, scope: OUTERMOST_SOURCE_SCOPE };
187 let return_block = BasicBlock::new(1);
188 let mut blocks = IndexVec::with_capacity(2);
189 let block = |blocks: &mut IndexVec<_, _>, kind| {
190 blocks.push(BasicBlockData {
192 terminator: Some(Terminator { source_info, kind }),
196 block(&mut blocks, TerminatorKind::Goto { target: return_block });
197 block(&mut blocks, TerminatorKind::Return);
199 let mut body = new_body(blocks,
200 IndexVec::from_elem_n(
201 SourceScopeData { span, parent_scope: None }, 1
203 local_decls_for_sig(&sig, span),
207 if let Some(..) = ty {
208 // The first argument (index 0), but add 1 for the return value.
209 let dropee_ptr = Place::from(Local::new(1+0));
210 if tcx.sess.opts.debugging_opts.mir_emit_retag {
211 // Function arguments should be retagged, and we make this one raw.
212 body.basic_blocks_mut()[START_BLOCK].statements.insert(0, Statement {
214 kind: StatementKind::Retag(RetagKind::Raw, box(dropee_ptr.clone())),
218 let param_env = tcx.param_env(def_id).with_reveal_all();
219 let mut elaborator = DropShimElaborator {
221 patch: MirPatch::new(&body),
225 let dropee = tcx.mk_place_deref(dropee_ptr);
226 let resume_block = elaborator.patch.resume_block();
227 elaborate_drops::elaborate_drop(
233 elaborate_drops::Unwind::To(resume_block),
238 patch.apply(&mut body);
244 fn new_body<'tcx>(basic_blocks: IndexVec<BasicBlock, BasicBlockData<'tcx>>,
245 source_scopes: IndexVec<SourceScope, SourceScopeData>,
246 local_decls: IndexVec<Local, LocalDecl<'tcx>>,
253 ClearCrossCrate::Clear,
265 pub struct DropShimElaborator<'a, 'tcx> {
266 pub body: &'a Body<'tcx>,
267 pub patch: MirPatch<'tcx>,
268 pub tcx: TyCtxt<'tcx>,
269 pub param_env: ty::ParamEnv<'tcx>,
272 impl<'a, 'tcx> fmt::Debug for DropShimElaborator<'a, 'tcx> {
273 fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
278 impl<'a, 'tcx> DropElaborator<'a, 'tcx> for DropShimElaborator<'a, 'tcx> {
281 fn patch(&mut self) -> &mut MirPatch<'tcx> { &mut self.patch }
282 fn body(&self) -> &'a Body<'tcx> { self.body }
283 fn tcx(&self) -> TyCtxt<'tcx> {
286 fn param_env(&self) -> ty::ParamEnv<'tcx> { self.param_env }
288 fn drop_style(&self, _path: Self::Path, mode: DropFlagMode) -> DropStyle {
289 if let DropFlagMode::Shallow = mode {
296 fn get_drop_flag(&mut self, _path: Self::Path) -> Option<Operand<'tcx>> {
300 fn clear_drop_flag(&mut self, _location: Location, _path: Self::Path, _mode: DropFlagMode) {
303 fn field_subpath(&self, _path: Self::Path, _field: Field) -> Option<Self::Path> {
306 fn deref_subpath(&self, _path: Self::Path) -> Option<Self::Path> {
309 fn downcast_subpath(&self, _path: Self::Path, _variant: VariantIdx) -> Option<Self::Path> {
312 fn array_subpath(&self, _path: Self::Path, _index: u32, _size: u32) -> Option<Self::Path> {
317 /// Builds a `Clone::clone` shim for `self_ty`. Here, `def_id` is `Clone::clone`.
318 fn build_clone_shim<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId, self_ty: Ty<'tcx>) -> Body<'tcx> {
319 debug!("build_clone_shim(def_id={:?})", def_id);
321 let param_env = tcx.param_env(def_id);
323 let mut builder = CloneShimBuilder::new(tcx, def_id, self_ty);
324 let is_copy = self_ty.is_copy_modulo_regions(tcx, param_env, builder.span);
326 let dest = Place::return_place();
327 let src = tcx.mk_place_deref(Place::from(Local::new(1+0)));
330 _ if is_copy => builder.copy_shim(),
331 ty::Array(ty, len) => {
332 let len = len.eval_usize(tcx, param_env);
333 builder.array_shim(dest, src, ty, len)
335 ty::Closure(def_id, substs) => {
336 builder.tuple_like_shim(
338 substs.as_closure().upvar_tys(def_id, tcx)
341 ty::Tuple(..) => builder.tuple_like_shim(dest, src, self_ty.tuple_fields()),
343 bug!("clone shim for `{:?}` which is not `Copy` and is not an aggregate", self_ty)
350 struct CloneShimBuilder<'tcx> {
353 local_decls: IndexVec<Local, LocalDecl<'tcx>>,
354 blocks: IndexVec<BasicBlock, BasicBlockData<'tcx>>,
356 sig: ty::FnSig<'tcx>,
359 impl CloneShimBuilder<'tcx> {
360 fn new(tcx: TyCtxt<'tcx>, def_id: DefId, self_ty: Ty<'tcx>) -> Self {
361 // we must subst the self_ty because it's
362 // otherwise going to be TySelf and we can't index
363 // or access fields of a Place of type TySelf.
364 let substs = tcx.mk_substs_trait(self_ty, &[]);
365 let sig = tcx.fn_sig(def_id).subst(tcx, substs);
366 let sig = tcx.erase_late_bound_regions(&sig);
367 let span = tcx.def_span(def_id);
372 local_decls: local_decls_for_sig(&sig, span),
373 blocks: IndexVec::new(),
379 fn into_mir(self) -> Body<'tcx> {
380 new_body(self.blocks,
381 IndexVec::from_elem_n(
382 SourceScopeData { span: self.span, parent_scope: None }, 1
385 self.sig.inputs().len(),
390 fn source_info(&self) -> SourceInfo {
391 SourceInfo { span: self.span, scope: OUTERMOST_SOURCE_SCOPE }
396 statements: Vec<Statement<'tcx>>,
397 kind: TerminatorKind<'tcx>,
400 let source_info = self.source_info();
401 self.blocks.push(BasicBlockData {
403 terminator: Some(Terminator { source_info, kind }),
408 /// Gives the index of an upcoming BasicBlock, with an offset.
409 /// offset=0 will give you the index of the next BasicBlock,
410 /// offset=1 will give the index of the next-to-next block,
411 /// offset=-1 will give you the index of the last-created block
412 fn block_index_offset(&mut self, offset: usize) -> BasicBlock {
413 BasicBlock::new(self.blocks.len() + offset)
416 fn make_statement(&self, kind: StatementKind<'tcx>) -> Statement<'tcx> {
418 source_info: self.source_info(),
423 fn copy_shim(&mut self) {
424 let rcvr = self.tcx.mk_place_deref(Place::from(Local::new(1+0)));
425 let ret_statement = self.make_statement(
426 StatementKind::Assign(
428 Place::return_place(),
429 Rvalue::Use(Operand::Copy(rcvr))
433 self.block(vec![ret_statement], TerminatorKind::Return, false);
436 fn make_place(&mut self, mutability: Mutability, ty: Ty<'tcx>) -> Place<'tcx> {
437 let span = self.span;
438 Place::from(self.local_decls.push(temp_decl(mutability, ty, span)))
451 let substs = tcx.mk_substs_trait(ty, &[]);
453 // `func == Clone::clone(&ty) -> ty`
454 let func_ty = tcx.mk_fn_def(self.def_id, substs);
455 let func = Operand::Constant(box Constant {
458 literal: ty::Const::zero_sized(tcx, func_ty),
461 let ref_loc = self.make_place(
463 tcx.mk_ref(tcx.lifetimes.re_erased, ty::TypeAndMut {
465 mutbl: hir::Mutability::Immutable,
469 // `let ref_loc: &ty = &src;`
470 let statement = self.make_statement(
471 StatementKind::Assign(
474 Rvalue::Ref(tcx.lifetimes.re_erased, BorrowKind::Shared, src)
479 // `let loc = Clone::clone(ref_loc);`
480 self.block(vec![statement], TerminatorKind::Call {
482 args: vec![Operand::Move(ref_loc)],
483 destination: Some((dest, next)),
484 cleanup: Some(cleanup),
493 loop_body: BasicBlock,
494 loop_end: BasicBlock,
499 let cond = self.make_place(Mutability::Mut, tcx.types.bool);
500 let compute_cond = self.make_statement(
501 StatementKind::Assign(
504 Rvalue::BinaryOp(BinOp::Ne, Operand::Copy(end), Operand::Copy(beg))
509 // `if end != beg { goto loop_body; } else { goto loop_end; }`
512 TerminatorKind::if_(tcx, Operand::Move(cond), loop_body, loop_end),
517 fn make_usize(&self, value: u64) -> Box<Constant<'tcx>> {
521 literal: ty::Const::from_usize(self.tcx, value),
525 fn array_shim(&mut self, dest: Place<'tcx>, src: Place<'tcx>, ty: Ty<'tcx>, len: u64) {
527 let span = self.span;
529 let beg = self.local_decls.push(temp_decl(Mutability::Mut, tcx.types.usize, span));
530 let end = self.make_place(Mutability::Not, tcx.types.usize);
533 // `let mut beg = 0;`
538 StatementKind::Assign(
541 Rvalue::Use(Operand::Constant(self.make_usize(0)))
546 StatementKind::Assign(
549 Rvalue::Use(Operand::Constant(self.make_usize(len)))
554 self.block(inits, TerminatorKind::Goto { target: BasicBlock::new(1) }, false);
561 self.loop_header(Place::from(beg),
568 // `dest[i] = Clone::clone(src[beg])`;
569 // Goto #3 if ok, #5 if unwinding happens.
570 let dest_field = self.tcx.mk_place_index(dest.clone(), beg);
571 let src_field = self.tcx.mk_place_index(src, beg);
572 self.make_clone_call(dest_field, src_field, ty, BasicBlock::new(3),
578 let statements = vec![
580 StatementKind::Assign(
585 Operand::Copy(Place::from(beg)),
586 Operand::Constant(self.make_usize(1))
592 self.block(statements, TerminatorKind::Goto { target: BasicBlock::new(1) }, false);
596 self.block(vec![], TerminatorKind::Return, false);
600 // `let mut beg = 0;`
603 let beg = self.local_decls.push(temp_decl(Mutability::Mut, tcx.types.usize, span));
604 let init = self.make_statement(
605 StatementKind::Assign(
608 Rvalue::Use(Operand::Constant(self.make_usize(0)))
612 self.block(vec![init], TerminatorKind::Goto { target: BasicBlock::new(6) }, true);
614 // BB #6 (cleanup): loop {
619 self.loop_header(Place::from(beg), Place::from(end),
620 BasicBlock::new(7), BasicBlock::new(9), true);
623 // `drop(dest[beg])`;
624 self.block(vec![], TerminatorKind::Drop {
625 location: self.tcx.mk_place_index(dest, beg),
626 target: BasicBlock::new(8),
633 let statement = self.make_statement(
634 StatementKind::Assign(
639 Operand::Copy(Place::from(beg)),
640 Operand::Constant(self.make_usize(1))
645 self.block(vec![statement], TerminatorKind::Goto { target: BasicBlock::new(6) }, true);
648 self.block(vec![], TerminatorKind::Resume, true);
651 fn tuple_like_shim<I>(&mut self, dest: Place<'tcx>,
652 src: Place<'tcx>, tys: I)
653 where I: Iterator<Item = Ty<'tcx>> {
654 let mut previous_field = None;
655 for (i, ity) in tys.enumerate() {
656 let field = Field::new(i);
657 let src_field = self.tcx.mk_place_field(src.clone(), field, ity);
659 let dest_field = self.tcx.mk_place_field(dest.clone(), field, ity);
661 // #(2i + 1) is the cleanup block for the previous clone operation
662 let cleanup_block = self.block_index_offset(1);
663 // #(2i + 2) is the next cloning block
664 // (or the Return terminator if this is the last block)
665 let next_block = self.block_index_offset(2);
668 // `dest.i = Clone::clone(&src.i);`
669 // Goto #(2i + 2) if ok, #(2i + 1) if unwinding happens.
670 self.make_clone_call(
678 // BB #(2i + 1) (cleanup)
679 if let Some((previous_field, previous_cleanup)) = previous_field.take() {
680 // Drop previous field and goto previous cleanup block.
681 self.block(vec![], TerminatorKind::Drop {
682 location: previous_field,
683 target: previous_cleanup,
687 // Nothing to drop, just resume.
688 self.block(vec![], TerminatorKind::Resume, true);
691 previous_field = Some((dest_field, cleanup_block));
694 self.block(vec![], TerminatorKind::Return, false);
698 /// Builds a "call" shim for `def_id`. The shim calls the
699 /// function specified by `call_kind`, first adjusting its first
700 /// argument according to `rcvr_adjustment`.
702 /// If `untuple_args` is a vec of types, the second argument of the
703 /// function will be untupled as these types.
704 fn build_call_shim<'tcx>(
707 rcvr_adjustment: Adjustment,
709 untuple_args: Option<&[Ty<'tcx>]>,
711 debug!("build_call_shim(def_id={:?}, rcvr_adjustment={:?}, \
712 call_kind={:?}, untuple_args={:?})",
713 def_id, rcvr_adjustment, call_kind, untuple_args);
715 let sig = tcx.fn_sig(def_id);
716 let sig = tcx.erase_late_bound_regions(&sig);
717 let span = tcx.def_span(def_id);
719 debug!("build_call_shim: sig={:?}", sig);
721 let mut local_decls = local_decls_for_sig(&sig, span);
722 let source_info = SourceInfo { span, scope: OUTERMOST_SOURCE_SCOPE };
724 let rcvr_arg = Local::new(1+0);
725 let rcvr_l = Place::from(rcvr_arg);
726 let mut statements = vec![];
728 let rcvr = match rcvr_adjustment {
729 Adjustment::Identity => Operand::Move(rcvr_l),
730 Adjustment::Deref => Operand::Copy(tcx.mk_place_deref(rcvr_l)),
731 Adjustment::DerefMove => {
732 // fn(Self, ...) -> fn(*mut Self, ...)
733 let arg_ty = local_decls[rcvr_arg].ty;
734 debug_assert!(tcx.generics_of(def_id).has_self && arg_ty == tcx.types.self_param);
735 local_decls[rcvr_arg].ty = tcx.mk_mut_ptr(arg_ty);
737 Operand::Move(tcx.mk_place_deref(rcvr_l))
739 Adjustment::RefMut => {
740 // let rcvr = &mut rcvr;
741 let ref_rcvr = local_decls.push(temp_decl(
743 tcx.mk_ref(tcx.lifetimes.re_erased, ty::TypeAndMut {
745 mutbl: hir::Mutability::Mutable
749 let borrow_kind = BorrowKind::Mut {
750 allow_two_phase_borrow: false,
752 statements.push(Statement {
754 kind: StatementKind::Assign(
756 Place::from(ref_rcvr),
757 Rvalue::Ref(tcx.lifetimes.re_erased, borrow_kind, rcvr_l)
761 Operand::Move(Place::from(ref_rcvr))
765 let (callee, mut args) = match call_kind {
766 CallKind::Indirect => (rcvr, vec![]),
767 CallKind::Direct(def_id) => {
768 let ty = tcx.type_of(def_id);
769 (Operand::Constant(box Constant {
772 literal: ty::Const::zero_sized(tcx, ty),
778 if let Some(untuple_args) = untuple_args {
779 args.extend(untuple_args.iter().enumerate().map(|(i, ity)| {
780 let arg_place = Place::from(Local::new(1+1));
781 Operand::Move(tcx.mk_place_field(arg_place, Field::new(i), *ity))
784 args.extend((1..sig.inputs().len()).map(|i| {
785 Operand::Move(Place::from(Local::new(1+i)))
789 let n_blocks = if let Adjustment::RefMut = rcvr_adjustment { 5 } else { 2 };
790 let mut blocks = IndexVec::with_capacity(n_blocks);
791 let block = |blocks: &mut IndexVec<_, _>, statements, kind, is_cleanup| {
792 blocks.push(BasicBlockData {
794 terminator: Some(Terminator { source_info, kind }),
800 block(&mut blocks, statements, TerminatorKind::Call {
803 destination: Some((Place::return_place(),
804 BasicBlock::new(1))),
805 cleanup: if let Adjustment::RefMut = rcvr_adjustment {
806 Some(BasicBlock::new(3))
813 if let Adjustment::RefMut = rcvr_adjustment {
814 // BB #1 - drop for Self
815 block(&mut blocks, vec![], TerminatorKind::Drop {
816 location: Place::from(rcvr_arg),
817 target: BasicBlock::new(2),
822 block(&mut blocks, vec![], TerminatorKind::Return, false);
823 if let Adjustment::RefMut = rcvr_adjustment {
824 // BB #3 - drop if closure panics
825 block(&mut blocks, vec![], TerminatorKind::Drop {
826 location: Place::from(rcvr_arg),
827 target: BasicBlock::new(4),
832 block(&mut blocks, vec![], TerminatorKind::Resume, true);
835 let mut body = new_body(
837 IndexVec::from_elem_n(
838 SourceScopeData { span, parent_scope: None }, 1
845 if let Abi::RustCall = sig.abi {
846 body.spread_arg = Some(Local::new(sig.inputs().len()));
851 pub fn build_adt_ctor(tcx: TyCtxt<'_>, ctor_id: DefId) -> &Body<'_> {
852 debug_assert!(tcx.is_constructor(ctor_id));
854 let span = tcx.hir().span_if_local(ctor_id)
855 .unwrap_or_else(|| bug!("no span for ctor {:?}", ctor_id));
857 let param_env = tcx.param_env(ctor_id);
859 // Normalize the sig.
860 let sig = tcx.fn_sig(ctor_id)
862 .expect("LBR in ADT constructor signature");
863 let sig = tcx.normalize_erasing_regions(param_env, sig);
865 let (adt_def, substs) = match sig.output().kind {
866 ty::Adt(adt_def, substs) => (adt_def, substs),
867 _ => bug!("unexpected type for ADT ctor {:?}", sig.output())
870 debug!("build_ctor: ctor_id={:?} sig={:?}", ctor_id, sig);
872 let local_decls = local_decls_for_sig(&sig, span);
874 let source_info = SourceInfo {
876 scope: OUTERMOST_SOURCE_SCOPE
879 let variant_index = if adt_def.is_enum() {
880 adt_def.variant_index_with_ctor_id(ctor_id)
885 // Generate the following MIR:
887 // (return as Variant).field0 = arg0;
888 // (return as Variant).field1 = arg1;
891 debug!("build_ctor: variant_index={:?}", variant_index);
893 let statements = expand_aggregate(
894 Place::return_place(),
896 .variants[variant_index]
900 .map(|(idx, field_def)| (
901 Operand::Move(Place::from(Local::new(idx + 1))),
902 field_def.ty(tcx, substs),
904 AggregateKind::Adt(adt_def, variant_index, substs, None, None),
909 let start_block = BasicBlockData {
911 terminator: Some(Terminator {
913 kind: TerminatorKind::Return,
919 IndexVec::from_elem_n(start_block, 1),
920 IndexVec::from_elem_n(
921 SourceScopeData { span, parent_scope: None }, 1
928 crate::util::dump_mir(
933 crate::transform::MirSource::item(ctor_id),
938 tcx.arena.alloc(body)