Skip to content

Commit

Permalink
Remove lift_to_global
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark-Simulacrum committed Sep 27, 2019
1 parent d540d44 commit f226ab4
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/librustc/mir/mod.rs
Expand Up @@ -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()
Expand Down
5 changes: 0 additions & 5 deletions src/librustc/ty/context.rs
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/ty/error.rs
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/ty/print/pretty.rs
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/borrow_check/mod.rs
Expand Up @@ -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: {:?}",
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_traits/chalk_context/mod.rs
Expand Up @@ -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),
}
Expand Down

0 comments on commit f226ab4

Please sign in to comment.