mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-01 07:48:45 +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 std::ops::ControlFlow::{self, Break, Continue};
|
||||||
|
|
||||||
use chalk_ir::{
|
use chalk_ir::{
|
||||||
|
@ -13,12 +14,14 @@ use crate::{
|
||||||
db::HirDatabase, Binders, ConcreteConst, Const, ConstValue, Interner, Substitution, Ty, TyKind,
|
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 {
|
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 mut uninhabited_from = UninhabitedFrom { target_mod, db };
|
||||||
let inhabitedness = ty.visit_with(&mut uninhabited_from, DebruijnIndex::INNERMOST);
|
let inhabitedness = ty.visit_with(&mut uninhabited_from, DebruijnIndex::INNERMOST);
|
||||||
inhabitedness == BREAK_VISIBLY_UNINHABITED
|
inhabitedness == BREAK_VISIBLY_UNINHABITED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Checks whether a variant is visibly uninhabited from a particular module.
|
||||||
pub(crate) fn is_enum_variant_uninhabited_from(
|
pub(crate) fn is_enum_variant_uninhabited_from(
|
||||||
variant: EnumVariantId,
|
variant: EnumVariantId,
|
||||||
subst: &Substitution,
|
subst: &Substitution,
|
||||||
|
|
Loading…
Reference in a new issue