Don't transform predicates in Inherited
This commit is contained in:
parent
c6d0a20f7b
commit
7106f8d8ee
@ -126,24 +126,8 @@ impl Inherited<'a, 'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
#[instrument(level = "debug", skip(self))]
|
||||
fn transform_predicate(&self, p: &mut ty::Predicate<'tcx>) {
|
||||
// Don't transform non-const bounds into const bounds,
|
||||
// but transform const bounds to non-const when we are
|
||||
// not in a const context.
|
||||
if let hir::Constness::NotConst = self.constness {
|
||||
let kind = p.kind();
|
||||
if let ty::PredicateKind::Trait(pred) = kind.as_ref().skip_binder() {
|
||||
let mut pred = *pred;
|
||||
pred.constness = hir::Constness::NotConst;
|
||||
*p = kind.rebind(ty::PredicateKind::Trait(pred)).to_predicate(self.tcx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn register_predicate(&self, mut obligation: traits::PredicateObligation<'tcx>) {
|
||||
pub(super) fn register_predicate(&self, obligation: traits::PredicateObligation<'tcx>) {
|
||||
debug!("register_predicate({:?})", obligation);
|
||||
self.transform_predicate(&mut obligation.predicate);
|
||||
if obligation.has_escaping_bound_vars() {
|
||||
span_bug!(obligation.cause.span, "escaping bound vars in predicate {:?}", obligation);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user