add note suggesting that predicate is satisfied but is not const

This commit is contained in:
Michael Goulet
2022-01-26 19:09:44 -08:00
parent 009c1d0248
commit 1ab97dbc52
9 changed files with 71 additions and 0 deletions

View File

@@ -803,6 +803,10 @@ impl<'tcx> PolyTraitPredicate<'tcx> {
p
});
}
pub fn is_const(self) -> bool {
self.skip_binder().constness == BoundConstness::ConstIfConst
}
}
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, TyEncodable, TyDecodable)]
@@ -1388,6 +1392,10 @@ impl<'tcx> ParamEnv<'tcx> {
self.packed.tag().constness
}
pub fn is_const(self) -> bool {
self.packed.tag().constness == hir::Constness::Const
}
/// Construct a trait environment with no where-clauses in scope
/// where the values of all `impl Trait` and other hidden types
/// are revealed. This is suitable for monomorphized, post-typeck
@@ -1503,6 +1511,7 @@ impl<'tcx> PolyTraitRef<'tcx> {
polarity: ty::ImplPolarity::Positive,
})
}
#[inline]
pub fn without_const(self) -> PolyTraitPredicate<'tcx> {
self.with_constness(BoundConstness::NotConst)