mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-29 06:23:25 +00:00
Add docs
This commit is contained in:
parent
8ae58b9fe4
commit
ffd79c2887
1 changed files with 3 additions and 0 deletions
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue