fix fn/const items implied bounds and wf check#104098
Closed
aliemjay wants to merge 4 commits intorust-lang:masterfrom
Closed
fix fn/const items implied bounds and wf check#104098aliemjay wants to merge 4 commits intorust-lang:masterfrom
aliemjay wants to merge 4 commits intorust-lang:masterfrom
Conversation
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.
These are two distinct changes (edit: actually three, see below):
Wf-check all fn item args. This is a soundness fix.
Fixes function type params are not checked for well-formedness #104005
Use implied bounds from impl header in borrowck of associated functions/consts. This strictly accepts more code and helps to mitigate the impact of other breaking changes.
Fixes implied bounds from impl header are not used in associated functions/consts #98852
Fixes Generic param requires bounds on call to function that is already required for calls to the caller #102611
The first is a breaking change and will likely have a big impact without the the second one. See the first commit for how it breaks libstd.
Landing the second one without the first will allow more incorrect code to pass. For example an exploit of #104005 would be as simple as:
The third change is to to check WF of user type annotations before normalizing them (fixes #104764, fixes #104763). It is mutually dependent on the second change above: an attempt to land it separately in #104746 caused several crater regressions that can all be mitigated by using the implied from the impl header. It is also necessary for the soundness of associated consts that use the implied bounds of impl header. See #104763 and how the third commit fixes the soundness issue in
tests/ui/wf/wf-associated-const.rsthat was introduces by the previous commit.cc @lcnr
r? types