-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use is_global
in candidate_should_be_dropped_in_favor_of
#90375
Conversation
This manifistated in rust-lang#90195 with compiler being unable to keep one candidate for a trait impl, if where is a global impl and more than one trait bound in the where clause. Before rust-lang#87280 `candidate_should_be_dropped_in_favor_of` was using `TypeFoldable::is_global()` that was enough to discard the two `ParamCandidate`s. But rust-lang#87280 changed it to use `TypeFoldable::is_known_global()` instead, which is pessimistic, so now the compiler drops the global impl instead (because `is_known_global` is not sure) and then can't decide between the two `ParamCandidate`s. Switching it to use `is_global` again solves the issue. Fixes rust-lang#90195.
(rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
#90266 does fix that issue in a more general way, but the underlying issue with Your PR is correct and probably just generally a good idea, so |
📌 Commit 9a0a622 has been approved by |
…laumeGomez Rollup of 5 pull requests Successful merges: - rust-lang#90156 (Remove underlines from non-top docblocks.) - rust-lang#90183 (Show all Deref implementations recursively) - rust-lang#90202 (Improve and test cross-crate hygiene) - rust-lang#90375 (Use `is_global` in `candidate_should_be_dropped_in_favor_of`) - rust-lang#90399 (Skipping verbose diagnostic suggestions when calling .as_ref() on type not implementing AsRef) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This manifistated in #90195 with compiler being unable to keep
one candidate for a trait impl, if where is a global impl and more
than one trait bound in the where clause.
Before #87280
candidate_should_be_dropped_in_favor_of
was usingTypeFoldable::is_global()
that was enough to discard the twoParamCandidate
s. But #87280 changed it to useTypeFoldable::is_known_global()
instead, which is pessimistic, sonow the compiler drops the global impl instead (because
is_known_global
is not sure) and then can't decide between thetwo
ParamCandidate
s.Switching it to use
is_global
again solves the issue.Fixes #90195.