about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDeadbeef <ent3rm4n@gmail.com>2021-07-26 12:06:32 +0800
committerDeadbeef <ent3rm4n@gmail.com>2021-08-13 09:28:51 +0000
commit7106f8d8ee2574c4fbd9b89e76bc1d177e867876 (patch)
treeeb6f7ecf14aa495f5cc54f2a8dcaf19092f07b99
parentc6d0a20f7baae2cec4488195d4ca873f10b0f63b (diff)
downloadrust-7106f8d8ee2574c4fbd9b89e76bc1d177e867876.tar.gz
rust-7106f8d8ee2574c4fbd9b89e76bc1d177e867876.zip
Don't transform predicates in Inherited
-rw-r--r--compiler/rustc_typeck/src/check/inherited.rs18
1 files changed, 1 insertions, 17 deletions
diff --git a/compiler/rustc_typeck/src/check/inherited.rs b/compiler/rustc_typeck/src/check/inherited.rs
index 36c376c7b89..9d9c77ec072 100644
--- a/compiler/rustc_typeck/src/check/inherited.rs
+++ b/compiler/rustc_typeck/src/check/inherited.rs
@@ -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);
         }