]> git.lizzy.rs Git - rust.git/commitdiff
add a function for testing if a ty is uninhabited from all modules
authorNiko Matsakis <niko@alum.mit.edu>
Thu, 21 Sep 2017 17:46:38 +0000 (13:46 -0400)
committerNiko Matsakis <niko@alum.mit.edu>
Mon, 16 Oct 2017 21:32:22 +0000 (17:32 -0400)
Desired by miri.

src/librustc/ty/inhabitedness/mod.rs

index 34e9084662ae54c4c172e1e34994c2d7b57e3a86..0072512464a0e95406d9d7ab3a9dde4b29efcb4a 100644 (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)
     }