Use is_global in candidate_should_be_dropped_in_favor_of#90375
Merged
bors merged 3 commits intorust-lang:masterfrom Oct 30, 2021
Merged
Use is_global in candidate_should_be_dropped_in_favor_of#90375bors merged 3 commits intorust-lang:masterfrom
is_global in candidate_should_be_dropped_in_favor_of#90375bors merged 3 commits intorust-lang:masterfrom
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.
Contributor
|
(rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
Contributor
Author
Contributor
#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 |
Collaborator
|
📌 Commit 9a0a622 has been approved by |
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Oct 30, 2021
…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
16 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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_ofwas usingTypeFoldable::is_global()that was enough to discard the twoParamCandidates. But #87280 changed it to useTypeFoldable::is_known_global()instead, which is pessimistic, sonow the compiler drops the global impl instead (because
is_known_globalis not sure) and then can't decide between thetwo
ParamCandidates.Switching it to use
is_globalagain solves the issue.Fixes #90195.