diff options
| author | iDawer <ilnur.iskhakov.oss@outlook.com> | 2022-09-02 17:01:51 +0500 |
|---|---|---|
| committer | iDawer <ilnur.iskhakov.oss@outlook.com> | 2022-09-02 17:01:51 +0500 |
| commit | ffd79c28879d102baf8adcee8f2603ab98c5852d (patch) | |
| tree | 6f338e53bba091ceb4022a6d193a3a389934f802 | |
| parent | 8ae58b9fe45aac9534475e2042729327c4485d5f (diff) | |
| download | rust-ffd79c28879d102baf8adcee8f2603ab98c5852d.tar.gz rust-ffd79c28879d102baf8adcee8f2603ab98c5852d.zip | |
Add docs
| -rw-r--r-- | crates/hir-ty/src/inhabitedness.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/crates/hir-ty/src/inhabitedness.rs b/crates/hir-ty/src/inhabitedness.rs index f3fe10c8575..0c547192ac0 100644 --- a/crates/hir-ty/src/inhabitedness.rs +++ b/crates/hir-ty/src/inhabitedness.rs @@ -1,3 +1,4 @@ +//! Type inhabitedness logic. use std::ops::ControlFlow::{self, Break, Continue}; use chalk_ir::{ @@ -13,12 +14,14 @@ use crate::{ db::HirDatabase, Binders, ConcreteConst, Const, ConstValue, Interner, Substitution, Ty, TyKind, }; +/// Checks whether a type is visibly uninhabited from a particular module. pub(crate) fn is_ty_uninhabited_from(ty: &Ty, target_mod: ModuleId, db: &dyn HirDatabase) -> bool { let mut uninhabited_from = UninhabitedFrom { target_mod, db }; let inhabitedness = ty.visit_with(&mut uninhabited_from, DebruijnIndex::INNERMOST); inhabitedness == BREAK_VISIBLY_UNINHABITED } +/// Checks whether a variant is visibly uninhabited from a particular module. pub(crate) fn is_enum_variant_uninhabited_from( variant: EnumVariantId, subst: &Substitution, |
