Don't look for non-type-level assoc consts when checking trait object types#153906
Closed
ViewWay wants to merge 1 commit intorust-lang:mainfrom
Closed
Don't look for non-type-level assoc consts when checking trait object types#153906ViewWay wants to merge 1 commit intorust-lang:mainfrom
ViewWay wants to merge 1 commit intorust-lang:mainfrom
Conversation
… types This is a cherry-pick of PR #153738 Problem: - PR #150843 introduced a regression where eager type aliases containing dyn Trait (with associated consts) would incorrectly report 'trait is not dyn compatible' errors - This affected 254 crates depending on old bitvec versions Root cause: - When checking for unspecified assoc items in trait object types, we were filtering for all associated consts (is_const()) - But eager type aliases don't get wfchecked at definition site - This broke the assumption that dyn-incompatible traits would be rejected early Fix: - Changed is_const() to is_type_const() to only check type-level associated consts, not regular associated consts - Regular associated consts cannot be bound in trait object types anyway, so checking them was unnecessary
Collaborator
Collaborator
|
r? @chenyukang rustbot has assigned @chenyukang. Use Why was this reviewer chosen?The reviewer was selected based on:
|
Collaborator
|
Member
|
@ViewWay I have no idea what you're trying to accomplish here but it makes no sense whatsoever for you to to cherry-pick / copy the commit I authored in open PR RUST-153906. Please cease this behavior immediately! |
Collaborator
|
The job Click to see the possible cause of the failure (guessed by this bot) |
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.
Fixes #153731.
This is a cherry-pick of PR #153738.
Problem
PR #150843 introduced a regression where eager type aliases containing
dyn Trait(with associated consts) would incorrectly report 'trait is not dyn compatible' errors. This affected 254 crates depending on old bitvec versions.Root Cause
When checking for unspecified assoc items in trait object types, we were filtering for all associated consts (
is_const()). But eager type aliases don't get wfchecked at definition site, which broke the assumption that dyn-incompatible traits would be rejected early.Fix
Changed
is_const()tois_type_const()to only check type-level associated consts, not regular associated consts. Regular associated consts cannot be bound in trait object types anyway, so checking them was unnecessary.