]> git.lizzy.rs Git - rust.git/commitdiff
Don't transform predicates in Inherited
authorDeadbeef <ent3rm4n@gmail.com>
Mon, 26 Jul 2021 04:06:32 +0000 (12:06 +0800)
committerDeadbeef <ent3rm4n@gmail.com>
Fri, 13 Aug 2021 09:28:51 +0000 (09:28 +0000)
compiler/rustc_typeck/src/check/inherited.rs

index 36c376c7b896e2a5ef524800b8aa0f9b5dab029c..9d9c77ec072b855c37dbfd5ddd17d8b66ad208ef 100644 (file)
@@ -126,24 +126,8 @@ pub(super) fn with_constness(
         }
     }
 
-    #[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);
         }