about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src/traits
diff options
context:
space:
mode:
authorlcnr <rust@lcnr.de>2022-07-14 12:47:38 +0200
committerlcnr <rust@lcnr.de>2022-07-14 12:48:50 +0200
commit864d2f35280aadeaf63f6e7efa483e173ebd62f6 (patch)
tree608de1f6e23879ad0a8111c7247f497e0eb2ab01 /compiler/rustc_trait_selection/src/traits
parent39a990d2f126b4751bd7821f26d166e07b073915 (diff)
downloadrust-864d2f35280aadeaf63f6e7efa483e173ebd62f6.tar.gz
rust-864d2f35280aadeaf63f6e7efa483e173ebd62f6.zip
eagerly check for bound vars of predicates
Diffstat (limited to 'compiler/rustc_trait_selection/src/traits')
-rw-r--r--compiler/rustc_trait_selection/src/traits/project.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/project.rs b/compiler/rustc_trait_selection/src/traits/project.rs
index 054308e441a..9de4d3a646c 100644
--- a/compiler/rustc_trait_selection/src/traits/project.rs
+++ b/compiler/rustc_trait_selection/src/traits/project.rs
@@ -756,6 +756,10 @@ impl<'tcx> TypeFolder<'tcx> for BoundVarReplacer<'_, 'tcx> {
             _ => ct.super_fold_with(self),
         }
     }
+
+    fn fold_predicate(&mut self, p: ty::Predicate<'tcx>) -> ty::Predicate<'tcx> {
+        if p.has_vars_bound_at_or_above(self.current_index) { p.super_fold_with(self) } else { p }
+    }
 }
 
 // The inverse of `BoundVarReplacer`: replaces placeholders with the bound vars from which they came.