Remove hack for filtering out param-env outlives that match item-bound outlives
This commit is contained in:
parent
7f75bfa1ad
commit
f3646748cd
1 changed files with 1 additions and 18 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue