add a function for testing if a ty is uninhabited from all modules

Desired by miri.
This commit is contained in:
Niko Matsakis 2017-09-21 13:46:38 -04:00
parent 0f568e2f34
commit 47449ea513

View file

@ -108,6 +108,10 @@ pub fn is_ty_uninhabited_from(self, module: DefId, ty: Ty<'tcx>) -> bool {
self.ty_inhabitedness_forest(ty).contains(self, module)
}
pub fn is_ty_uninhabited_from_all_modules(self, ty: Ty<'tcx>) -> bool {
!self.ty_inhabitedness_forest(ty).is_empty()
}
fn ty_inhabitedness_forest(self, ty: Ty<'tcx>) -> DefIdForest {
ty.uninhabited_from(&mut FxHashMap(), self)
}