drive-by: use is_const and is_const_if_const

This commit is contained in:
Michael Goulet
2022-01-26 19:24:01 -08:00
parent 1ab97dbc52
commit c6de4d55aa
7 changed files with 16 additions and 15 deletions

View File

@@ -784,6 +784,11 @@ impl<'tcx> TraitPredicate<'tcx> {
pub fn self_ty(self) -> Ty<'tcx> {
self.trait_ref.self_ty()
}
#[inline]
pub fn is_const_if_const(self) -> bool {
self.constness == BoundConstness::ConstIfConst
}
}
impl<'tcx> PolyTraitPredicate<'tcx> {
@@ -804,8 +809,9 @@ impl<'tcx> PolyTraitPredicate<'tcx> {
});
}
pub fn is_const(self) -> bool {
self.skip_binder().constness == BoundConstness::ConstIfConst
#[inline]
pub fn is_const_if_const(self) -> bool {
self.skip_binder().is_const_if_const()
}
}
@@ -1392,6 +1398,7 @@ impl<'tcx> ParamEnv<'tcx> {
self.packed.tag().constness
}
#[inline]
pub fn is_const(self) -> bool {
self.packed.tag().constness == hir::Constness::Const
}