Merged
Conversation
TomAFrench
reviewed
May 21, 2025
TomAFrench
reviewed
May 21, 2025
Contributor
There was a problem hiding this comment.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark 'Compilation Time'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.
| Benchmark suite | Current: 590361d | Previous: 4ee2d12 | Ratio |
|---|---|---|---|
rollup-base-private |
21.82 s |
15.94 s |
1.37 |
This comment was automatically generated by workflow using github-action-benchmark.
CC: @TomAFrench
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.
Description
Problem
A requirement for #8395
Summary
In order to implement this several things needed to be done:
associated_type_boundsfield ofTrait.T: FoowhereFoohas an associated typeEwith a bound on it, we need to introduce those bounds on the associated type. However, I faced a challenge here because traits were collected after defining function metas, and it's when collecting traits that we find out about these bounds. For this, I splitcollect_traitsinto two:collect_traitsandcollect_trait_methods.collect_traitsruns before defining function metas and it's here that we collect these bounds. This worked!Foo::Eto beBarinsideeq, but for that to work it needed to be put in thetrait_constraintsfield ofFuncMeta. But if we do that then those constraints don't match the one (none) on theeqdefinition of theEqtrait.For this, I decided to split the
trait_constraintsfield ofFuncMetainto two:trait_constraints: these are just the ones from the where clause on the functionextra_trait_constraints: these are the ones from the parent trait impl, and also ones for implicitly added named generics (likeFoo:Eabove)Then when checking that the trait constraints match, we just check in
trait_constraints. For knowing all the trait constraints needed for the function to work, there's a newall_trait_constraints()method.BuildHasherfrom beingBuildHasher<H>to havingHas an associated type with a bound. It worked!The one thing missing (there's a TODO about this) is being able to put a where clause on a trait, with that where clause referring to a trait that has an associated type with bounds. This example in particular:
Given that we currently don't have code for this, and it's not needed for
BuildHasher, I'd prefer to implement it as a follow-up PR. ATraitobject has awhere_clause, but we'd likely need to split that into two too (not sure!).Additional Context
Documentation*
Check one:
PR Checklist*
cargo fmton default settings.