use crate::middle::lang_items;
use crate::middle::resolve_lifetime::{self, ObjectLifetimeDefault};
use crate::middle::stability;
-use crate::mir::{self, Mir, interpret, ProjectionKind};
-use crate::mir::interpret::{ConstValue, Allocation};
+use crate::mir::{self, Body, interpret, ProjectionKind};
+use crate::mir::interpret::{ConstValue, Allocation, Scalar};
use crate::ty::subst::{Kind, InternalSubsts, SubstsRef, Subst};
use crate::ty::ReprOptions;
use crate::traits;
generics: TypedArena<ty::Generics>,
trait_def: TypedArena<ty::TraitDef>,
adt_def: TypedArena<ty::AdtDef>,
- steal_mir: TypedArena<Steal<Mir<'tcx>>>,
- mir: TypedArena<Mir<'tcx>>,
+ steal_mir: TypedArena<Steal<Body<'tcx>>>,
+ mir: TypedArena<Body<'tcx>>,
tables: TypedArena<ty::TypeckTables<'tcx>>,
/// miri allocations
const_allocs: TypedArena<interpret::Allocation>,
};
CommonConsts {
- err: mk_const(ty::Const::zero_sized(types.err)),
+ err: mk_const(ty::Const {
+ val: ConstValue::Scalar(Scalar::zst()),
+ ty: types.err,
+ }),
}
}
}
self.global_arenas.generics.alloc(generics)
}
- pub fn alloc_steal_mir(self, mir: Mir<'gcx>) -> &'gcx Steal<Mir<'gcx>> {
+ pub fn alloc_steal_mir(self, mir: Body<'gcx>) -> &'gcx Steal<Body<'gcx>> {
self.global_arenas.steal_mir.alloc(Steal::new(mir))
}
- pub fn alloc_mir(self, mir: Mir<'gcx>) -> &'gcx Mir<'gcx> {
+ pub fn alloc_mir(self, mir: Body<'gcx>) -> &'gcx Body<'gcx> {
self.global_arenas.mir.alloc(mir)
}
// this is the impl for `&'a InternalSubsts<'a>`
nop_list_lift!{Kind<'a> => Kind<'tcx>}
-impl<'a, 'tcx> Lift<'tcx> for &'a mir::interpret::Allocation {
- type Lifted = &'tcx mir::interpret::Allocation;
- fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option<Self::Lifted> {
- assert!(tcx.global_arenas.const_allocs.in_arena(*self as *const _));
- Some(unsafe { mem::transmute(*self) })
- }
-}
-
pub mod tls {
use super::{GlobalCtxt, TyCtxt, ptr_eq};
#[inline]
pub fn mk_array(self, ty: Ty<'tcx>, n: u64) -> Ty<'tcx> {
- self.mk_ty(Array(ty, self.mk_const(
- ty::Const::from_usize(self.global_tcx(), n)
- )))
+ self.mk_ty(Array(ty, ty::Const::from_usize(self.global_tcx(), n)))
}
#[inline]