Fix diagnostics for unfulfilled obligations

This commit is contained in:
Deadbeef
2022-07-26 13:57:19 +00:00
parent d60ebe366b
commit 71e162e6ca
5 changed files with 20 additions and 26 deletions

View File

@@ -829,6 +829,14 @@ impl<'tcx> TraitPredicate<'tcx> {
pub fn is_const_if_const(self) -> bool {
self.constness == BoundConstness::ConstIfConst
}
pub fn is_constness_satisfied_by(self, constness: hir::Constness) -> bool {
match (self.constness, constness) {
(BoundConstness::NotConst, _)
| (BoundConstness::ConstIfConst, hir::Constness::Const) => true,
(BoundConstness::ConstIfConst, hir::Constness::NotConst) => false,
}
}
}
impl<'tcx> PolyTraitPredicate<'tcx> {