Skip to content

Commit 47449ea

Browse files
committed
add a function for testing if a ty is uninhabited from all modules
Desired by miri.
1 parent 0f568e2 commit 47449ea

File tree

1 file changed

+4
-0
lines changed
  • src/librustc/ty/inhabitedness

1 file changed

+4
-0
lines changed

src/librustc/ty/inhabitedness/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
108108
self.ty_inhabitedness_forest(ty).contains(self, module)
109109
}
110110

111+
pub fn is_ty_uninhabited_from_all_modules(self, ty: Ty<'tcx>) -> bool {
112+
!self.ty_inhabitedness_forest(ty).is_empty()
113+
}
114+
111115
fn ty_inhabitedness_forest(self, ty: Ty<'tcx>) -> DefIdForest {
112116
ty.uninhabited_from(&mut FxHashMap(), self)
113117
}

0 commit comments

Comments
 (0)