Skip to content

Commit 8cadd59

Browse files
committed
Correctly lift empty lists of clauses and goals
1 parent 37ef0c3 commit 8cadd59

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/librustc/ty/context.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1714,6 +1714,10 @@ impl<'a, 'tcx> Lift<'tcx> for &'a List<Goal<'a>> {
17141714
&self,
17151715
tcx: TyCtxt<'b, 'gcx, 'tcx>,
17161716
) -> Option<&'tcx List<Goal<'tcx>>> {
1717+
if self.is_empty() {
1718+
return Some(List::empty());
1719+
}
1720+
17171721
if tcx.interners.arena.in_arena(*self as *const _) {
17181722
return Some(unsafe { mem::transmute(*self) });
17191723
}
@@ -1732,6 +1736,10 @@ impl<'a, 'tcx> Lift<'tcx> for &'a List<Clause<'a>> {
17321736
&self,
17331737
tcx: TyCtxt<'b, 'gcx, 'tcx>,
17341738
) -> Option<&'tcx List<Clause<'tcx>>> {
1739+
if self.is_empty() {
1740+
return Some(List::empty());
1741+
}
1742+
17351743
if tcx.interners.arena.in_arena(*self as *const _) {
17361744
return Some(unsafe { mem::transmute(*self) });
17371745
}

0 commit comments

Comments
 (0)