Skip to content

Commit

Permalink
Properly lift Allocations
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed Jan 1, 2019
1 parent 48aa819 commit e42b21b
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/librustc/ty/context.rs
Expand Up @@ -1811,15 +1811,8 @@ impl<'a, 'tcx> Lift<'tcx> for &'a LazyConst<'a> {
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> {
if tcx.interners.arena.in_arena(*self as *const _) {
return Some(unsafe { mem::transmute(*self) });
}
// Also try in the global tcx if we're not that.
if !tcx.is_global() {
self.lift_to_tcx(tcx.global_tcx())
} else {
None
}
assert!(tcx.global_interners.arena.in_arena(*self as *const _));
Some(unsafe { mem::transmute(*self) })
}
}

Expand Down

0 comments on commit e42b21b

Please sign in to comment.