Skip to content

Commit f364674

Browse files
Remove hack for filtering out param-env outlives that match item-bound outlives
1 parent 7f75bfa commit f364674

File tree

1 file changed

+1
-18
lines changed

1 file changed

+1
-18
lines changed

Diff for: compiler/rustc_infer/src/infer/outlives/obligations.rs

+1-18
Original file line numberDiff line numberDiff line change
@@ -388,26 +388,9 @@ where
388388
// Compute the bounds we can derive from the environment. This
389389
// is an "approximate" match -- in some cases, these bounds
390390
// may not apply.
391-
let mut approx_env_bounds = self.verify_bound.approx_declared_bounds_from_env(alias_ty);
391+
let approx_env_bounds = self.verify_bound.approx_declared_bounds_from_env(alias_ty);
392392
debug!(?approx_env_bounds);
393393

394-
// Remove outlives bounds that we get from the environment but
395-
// which are also deducible from the trait. This arises (cc
396-
// #55756) in cases where you have e.g., `<T as Foo<'a>>::Item:
397-
// 'a` in the environment but `trait Foo<'b> { type Item: 'b
398-
// }` in the trait definition.
399-
approx_env_bounds.retain(|bound_outlives| {
400-
// OK to skip binder because we only manipulate and compare against other values from
401-
// the same binder. e.g. if we have (e.g.) `for<'a> <T as Trait<'a>>::Item: 'a` in
402-
// `bound`, the `'a` will be a `^1` (bound, debruijn index == innermost) region. If the
403-
// declaration is `trait Trait<'b> { type Item: 'b; }`, then
404-
// `projection_declared_bounds_from_trait` will be invoked with `['b => ^1]` and so we
405-
// will get `^1` returned.
406-
let bound = bound_outlives.skip_binder();
407-
let ty::Alias(_, alias_ty) = bound.0.kind() else { bug!("expected AliasTy") };
408-
self.verify_bound.declared_bounds_from_definition(*alias_ty).all(|r| r != bound.1)
409-
});
410-
411394
// If declared bounds list is empty, the only applicable rule is
412395
// OutlivesProjectionComponent. If there are inference variables,
413396
// then, we can break down the outlives into more primitive

0 commit comments

Comments
 (0)