diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index 7bb547dbced..289ef4da992 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -1714,6 +1714,10 @@ impl<'a, 'tcx> Lift<'tcx> for &'a List> { &self, tcx: TyCtxt<'b, 'gcx, 'tcx>, ) -> Option<&'tcx List>> { + if self.is_empty() { + return Some(List::empty()); + } + if tcx.interners.arena.in_arena(*self as *const _) { return Some(unsafe { mem::transmute(*self) }); } @@ -1732,6 +1736,10 @@ impl<'a, 'tcx> Lift<'tcx> for &'a List> { &self, tcx: TyCtxt<'b, 'gcx, 'tcx>, ) -> Option<&'tcx List>> { + if self.is_empty() { + return Some(List::empty()); + } + if tcx.interners.arena.in_arena(*self as *const _) { return Some(unsafe { mem::transmute(*self) }); }