about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2025-01-02 00:38:11 +0000
committerMichael Goulet <michael@errs.io>2025-01-02 00:48:06 +0000
commitf3646748cd9d3cf5a6834f299acd10af1fe99c1b (patch)
tree374b66aab9325f980a25580d80645dd93d5ce002
parent7f75bfa1ad4e9a9d33a179a90603001515e91991 (diff)
downloadrust-f3646748cd9d3cf5a6834f299acd10af1fe99c1b.tar.gz
rust-f3646748cd9d3cf5a6834f299acd10af1fe99c1b.zip
Remove hack for filtering out param-env outlives that match item-bound outlives
-rw-r--r--compiler/rustc_infer/src/infer/outlives/obligations.rs19
1 files changed, 1 insertions, 18 deletions
diff --git a/compiler/rustc_infer/src/infer/outlives/obligations.rs b/compiler/rustc_infer/src/infer/outlives/obligations.rs
index b1d5d688295..3512b2a5657 100644
--- a/compiler/rustc_infer/src/infer/outlives/obligations.rs
+++ b/compiler/rustc_infer/src/infer/outlives/obligations.rs
@@ -388,26 +388,9 @@ where
         // Compute the bounds we can derive from the environment. This
         // is an "approximate" match -- in some cases, these bounds
         // may not apply.
-        let mut approx_env_bounds = self.verify_bound.approx_declared_bounds_from_env(alias_ty);
+        let approx_env_bounds = self.verify_bound.approx_declared_bounds_from_env(alias_ty);
         debug!(?approx_env_bounds);
 
-        // Remove outlives bounds that we get from the environment but
-        // which are also deducible from the trait. This arises (cc
-        // #55756) in cases where you have e.g., `<T as Foo<'a>>::Item:
-        // 'a` in the environment but `trait Foo<'b> { type Item: 'b
-        // }` in the trait definition.
-        approx_env_bounds.retain(|bound_outlives| {
-            // OK to skip binder because we only manipulate and compare against other values from
-            // the same binder. e.g. if we have (e.g.) `for<'a> <T as Trait<'a>>::Item: 'a` in
-            // `bound`, the `'a` will be a `^1` (bound, debruijn index == innermost) region. If the
-            // declaration is `trait Trait<'b> { type Item: 'b; }`, then
-            // `projection_declared_bounds_from_trait` will be invoked with `['b => ^1]` and so we
-            // will get `^1` returned.
-            let bound = bound_outlives.skip_binder();
-            let ty::Alias(_, alias_ty) = bound.0.kind() else { bug!("expected AliasTy") };
-            self.verify_bound.declared_bounds_from_definition(*alias_ty).all(|r| r != bound.1)
-        });
-
         // If declared bounds list is empty, the only applicable rule is
         // OutlivesProjectionComponent. If there are inference variables,
         // then, we can break down the outlives into more primitive