Remove constness
from ParamEnv
This commit is contained in:
parent
3e11b223d7
commit
e6b423aebb
34 changed files with 89 additions and 361 deletions
|
@ -79,7 +79,6 @@ impl<'tcx> PredicateObligation<'tcx> {
|
|||
}
|
||||
|
||||
pub fn without_const(mut self, tcx: TyCtxt<'tcx>) -> PredicateObligation<'tcx> {
|
||||
self.param_env = self.param_env.without_const();
|
||||
if let ty::PredicateKind::Clause(ty::ClauseKind::Trait(trait_pred)) = self.predicate.kind().skip_binder() && trait_pred.is_const_if_const() {
|
||||
self.predicate = tcx.mk_predicate(self.predicate.kind().map_bound(|_| ty::PredicateKind::Clause(ty::ClauseKind::Trait(trait_pred.without_const()))));
|
||||
}
|
||||
|
@ -88,14 +87,6 @@ impl<'tcx> PredicateObligation<'tcx> {
|
|||
}
|
||||
|
||||
impl<'tcx> PolyTraitObligation<'tcx> {
|
||||
/// Returns `true` if the trait predicate is considered `const` in its ParamEnv.
|
||||
pub fn is_const(&self) -> bool {
|
||||
matches!(
|
||||
(self.predicate.skip_binder().constness, self.param_env.constness()),
|
||||
(ty::BoundConstness::ConstIfConst, hir::Constness::Const)
|
||||
)
|
||||
}
|
||||
|
||||
pub fn derived_cause(
|
||||
&self,
|
||||
variant: impl FnOnce(DerivedObligationCause<'tcx>) -> ObligationCauseCode<'tcx>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue