]> git.lizzy.rs Git - rust.git/commitdiff
Correctly lift empty lists of clauses and goals
authorscalexm <alexandre@scalexm.fr>
Fri, 23 Nov 2018 18:47:22 +0000 (19:47 +0100)
committerscalexm <alexandre@scalexm.fr>
Thu, 27 Dec 2018 18:21:15 +0000 (19:21 +0100)
src/librustc/ty/context.rs

index 7bb547dbceda22572c76cc2f6837f3e61a3103f9..289ef4da9922766cceeb3e92bd3ec7b392ea0468 100644 (file)
@@ -1714,6 +1714,10 @@ fn lift_to_tcx<'b, 'gcx>(
         &self,
         tcx: TyCtxt<'b, 'gcx, 'tcx>,
     ) -> Option<&'tcx List<Goal<'tcx>>> {
+        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 @@ fn lift_to_tcx<'b, 'gcx>(
         &self,
         tcx: TyCtxt<'b, 'gcx, 'tcx>,
     ) -> Option<&'tcx List<Clause<'tcx>>> {
+        if self.is_empty() {
+            return Some(List::empty());
+        }
+
         if tcx.interners.arena.in_arena(*self as *const _) {
             return Some(unsafe { mem::transmute(*self) });
         }