1
Fork 0

Add Ty::is_union predicate and use it

This commit is contained in:
Tomasz Miąsko 2021-06-02 00:00:00 +00:00
parent 012c323467
commit c898681a86
10 changed files with 31 additions and 55 deletions

View file

@ -1840,6 +1840,11 @@ impl<'tcx> TyS<'tcx> {
matches!(self.kind(), Adt(adt_def, _) if adt_def.is_enum())
}
#[inline]
pub fn is_union(&self) -> bool {
matches!(self.kind(), Adt(adt_def, _) if adt_def.is_union())
}
#[inline]
pub fn is_closure(&self) -> bool {
matches!(self.kind(), Closure(..))