1
Fork 0

Fix hack that remaps env constness.

WARNING: might have perf implications.

Are there any more problems with having a constness
in the `ParamEnv` now? :)
This commit is contained in:
Deadbeef 2022-07-20 17:33:45 +00:00
parent d695a497bb
commit 8464396a19
4 changed files with 41 additions and 62 deletions

View file

@ -575,6 +575,19 @@ impl<'tcx> Predicate<'tcx> {
Some(tcx.mk_predicate(kind))
}
pub fn without_const(mut self, tcx: TyCtxt<'tcx>) -> Self {
if let PredicateKind::Trait(TraitPredicate { trait_ref, constness, polarity }) = self.kind().skip_binder()
&& constness != BoundConstness::NotConst
{
self = tcx.mk_predicate(self.kind().map_bound(|_| PredicateKind::Trait(TraitPredicate {
trait_ref,
constness: BoundConstness::NotConst,
polarity,
})));
}
self
}
}
impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for Predicate<'tcx> {