Correctly substitute GAT's type used in normalize_param_env
in check_type_bounds
#109470
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Given:
We add an additional predicate in the
normalize_param_env
incheck_type_bounds
that is used to normalize the GAT's bounds to check them in the impl. Problematically, though, that predicate is constructed to befor<^0> <() as Foo>::Assoc<^0> => Wrapper<T>
, instead offor<^0> <() as Foo>::Assoc<^0> => Wrapper<^0>
.That means
Self::Assoc<i32>
in the bounds that we're checking normalizes toWrapper<T>
, instead ofWrapper<i32>
, and so the boundSelf::Assoc<T>: PartialEq<Self::Assoc<i32>>
normalizes toWrapper<T>: PartialEq<Wrapper<T>>
, which does not hold.Fixes this by properly substituting the RHS of that normalizes predicate that we add to the
normalize_param_env
. That means the bound is properly normalized toWrapper<T>: PartialEq<Wrapper<i32>>
, which does hold.The second commit in this PR just cleans up some substs stuff and some naming.
r? @jackh726 cc #87900