From 8cadd59674be7211edf32485f562b6d75c578155 Mon Sep 17 00:00:00 2001 From: scalexm Date: Fri, 23 Nov 2018 19:47:22 +0100 Subject: [PATCH] Correctly lift empty lists of clauses and goals --- src/librustc/ty/context.rs | 8 ++++++++ 1 file changed, 8 insertions(+) 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) }); }