Skip to content

Commit b1422da

Browse files
committed
Don't transform predicates in Inherited
1 parent 266efb5 commit b1422da

File tree

1 file changed

+2
-18
lines changed

1 file changed

+2
-18
lines changed

compiler/rustc_typeck/src/check/inherited.rs

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use rustc_hir::HirIdMap;
99
use rustc_infer::infer;
1010
use rustc_infer::infer::{InferCtxt, InferOk, TyCtxtInferExt};
1111
use rustc_middle::ty::fold::TypeFoldable;
12-
use rustc_middle::ty::{self, OpaqueTypeKey, ToPredicate, Ty, TyCtxt};
12+
use rustc_middle::ty::{self, OpaqueTypeKey, Ty, TyCtxt};
1313
use rustc_span::{self, Span};
1414
use rustc_trait_selection::infer::InferCtxtExt as _;
1515
use rustc_trait_selection::opaque_types::OpaqueTypeDecl;
@@ -144,24 +144,8 @@ impl Inherited<'a, 'tcx> {
144144
}
145145
}
146146

147-
#[instrument(level = "debug", skip(self))]
148-
fn transform_predicate(&self, p: &mut ty::Predicate<'tcx>) {
149-
// Don't transform non-const bounds into const bounds,
150-
// but transform const bounds to non-const when we are
151-
// not in a const context.
152-
if let hir::Constness::NotConst = self.constness {
153-
let kind = p.kind();
154-
if let ty::PredicateKind::Trait(pred) = kind.as_ref().skip_binder() {
155-
let mut pred = *pred;
156-
pred.constness = hir::Constness::NotConst;
157-
*p = kind.rebind(ty::PredicateKind::Trait(pred)).to_predicate(self.tcx);
158-
}
159-
}
160-
}
161-
162-
pub(super) fn register_predicate(&self, mut obligation: traits::PredicateObligation<'tcx>) {
147+
pub(super) fn register_predicate(&self, obligation: traits::PredicateObligation<'tcx>) {
163148
debug!("register_predicate({:?})", obligation);
164-
self.transform_predicate(&mut obligation.predicate);
165149
if obligation.has_escaping_bound_vars() {
166150
span_bug!(obligation.cause.span, "escaping bound vars in predicate {:?}", obligation);
167151
}

0 commit comments

Comments
 (0)