Be more careful about elaboration around trait aliases#104745
Be more careful about elaboration around trait aliases#104745compiler-errors wants to merge 4 commits intorust-lang:masterfrom
Conversation
|
r? @jackh726 (rustbot has picked a reviewer for you, use r? to override) |
|
☔ The latest upstream changes (presumably #104758) made this pull request unmergeable. Please resolve the merge conflicts. |
27bd8a6 to
1e39dc2
Compare
|
☔ The latest upstream changes (presumably #104846) made this pull request unmergeable. Please resolve the merge conflicts. |
|
I'm a bit on the fence for this. Seems like there is a better solution to find than filtering predicates in a lot of places. |
|
@jackh726 that's kind of vague -- what better solution are you suggesting? The fact is that it's really up to the specific code doing the elaboration whether it needs to care about supertraits that share a |
|
It's pretty vague because I don't quite know the right solution - but whatever it is, I don't think it's this. Pushing this up to to elaboration seems reasonable? |
…filter-only-super-traits, r=oli-obk Split implied and super predicate queries, then allow elaborator to filter only supertraits Split the `super_predicates_of` query into a new `implied_predicates_of` query. The former now only returns the *real* supertraits of a trait alias, and the latter now returns the implied predicates (which include all of the `where` clauses of the trait alias). The behavior of these queries is identical for regular traits. Now that the two queries are split, we can add a new filter method to the elaborator, `filter_only_self()`, which can be used in instances that we need only the *supertrait* predicates, such as during the elaboration used in closure signature deduction. This toggles the usage of `super_predicates_of` instead of `implied_predicates_of` during elaboration of a trait predicate. This supersedes rust-lang#104745, and fixes the four independent bugs identified in that PR. Fixes rust-lang#104719 Fixes rust-lang#106238 Fixes rust-lang#110023 Fixes rust-lang#109514 r? types
Fixes four separate (but similar) bugs that were found when it comes to trait aliases, for which the
traits::util::elaborate_*methods can return predicates that have a differentSelftype than the one we started with.Fixes #104719
Fixes #106238