Skip to content
Permalink
Browse files

Remove lift_to_global

  • Loading branch information...
Mark-Simulacrum committed Sep 25, 2019
1 parent d540d44 commit f226ab4ad97fbc2e183d319616f17998c66f64e8
@@ -1504,7 +1504,7 @@ impl<'tcx> TerminatorKind<'tcx> {
Goto { .. } => vec!["".into()],
SwitchInt { ref values, switch_ty, .. } => ty::tls::with(|tcx| {
let param_env = ty::ParamEnv::empty();
let switch_ty = tcx.lift_to_global(&switch_ty).unwrap();
let switch_ty = tcx.lift(&switch_ty).unwrap();
let size = tcx.layout_of(param_env.and(switch_ty)).unwrap().size;
values
.iter()
@@ -1148,11 +1148,6 @@ impl<'tcx> TyCtxt<'tcx> {
value.lift_to_tcx(self)
}

/// Like lift, but only tries in the global tcx.
pub fn lift_to_global<T: ?Sized + Lift<'tcx>>(self, value: &T) -> Option<T::Lifted> {
value.lift_to_tcx(self)
}

/// Creates a type context and call the closure with a `TyCtxt` reference
/// to the context. The closure enforces that the type context and any interned
/// value (types, substs, etc.) can only be used while `ty::tls` has a valid
@@ -193,7 +193,7 @@ impl<'tcx> ty::TyS<'tcx> {
ty::Adt(def, _) => format!("{} `{}`", def.descr(), tcx.def_path_str(def.did)).into(),
ty::Foreign(def_id) => format!("extern type `{}`", tcx.def_path_str(def_id)).into(),
ty::Array(_, n) => {
let n = tcx.lift_to_global(&n).unwrap();
let n = tcx.lift(&n).unwrap();
match n.try_eval_usize(tcx, ty::ParamEnv::empty()) {
Some(n) => {
format!("array of {} element{}", n, pluralise!(n)).into()
@@ -917,7 +917,7 @@ pub trait PrettyPrinter<'tcx>:
let min = 1u128 << (bit_size - 1);
let max = min - 1;

let ty = self.tcx().lift_to_global(&ct.ty).unwrap();
let ty = self.tcx().lift(&ct.ty).unwrap();
let size = self.tcx().layout_of(ty::ParamEnv::empty().and(ty))
.unwrap()
.size;
@@ -632,7 +632,7 @@ impl<'cx, 'tcx> DataflowResultsConsumer<'cx, 'tcx> for MirBorrowckCtxt<'cx, 'tcx
// "Lift" into the tcx -- once regions are erased, this type should be in the
// global arenas; this "lift" operation basically just asserts that is true, but
// that is useful later.
tcx.lift_to_global(&drop_place_ty).unwrap();
tcx.lift(&drop_place_ty).unwrap();

debug!("visit_terminator_drop \
loc: {:?} term: {:?} drop_place: {:?} drop_place_ty: {:?} span: {:?}",
@@ -474,7 +474,7 @@ impl context::UnificationOps<ChalkArenas<'tcx>, ChalkArenas<'tcx>>
&self,
value: DelayedLiteral<ChalkArenas<'tcx>>,
) -> DelayedLiteral<ChalkArenas<'tcx>> {
match self.infcx.tcx.lift_to_global(&value) {
match self.infcx.tcx.lift(&value) {
Some(literal) => literal,
None => bug!("cannot lift {:?}", value),
}

0 comments on commit f226ab4

Please sign in to comment.
You can’t perform that action at this time.