Fix/issue 152607 supertrait assoc type bound#156593
Open
spirali wants to merge 3 commits into
Open
Conversation
…ormedness When forming a trait object like `dyn Sub<Assoc = String>` where `trait Sub: Super<Assoc: Copy>`, the compiler was not verifying that `String: Copy`. This allowed unsound code to compile, potentially leading to use-after-free vulnerabilities. The root cause was that both the old and new trait solvers used `explicit_super_predicates_of` which only yields `Self: SuperTrait` predicates, but not the associated type bounds from those supertraits. For example, `trait Sub: Super<Assoc: Copy>` expands to both `Self: Super` and `<Self as Super>::Assoc: Copy`, but only the first was being checked. This change switches to `explicit_implied_predicates_of` in both: - The old solver's `confirm_object_candidate` - The new solver's `predicates_for_object_candidate` This ensures that associated type bounds from supertraits are properly verified when constructing trait objects.
Collaborator
|
changes to the core type system cc @lcnr |
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.
This tries to fix #152607.
This PR is based on #153518.
dyncase, so I have tried to fix it on my own, but I am not sure about the correctness of this fix.r? lcnr