Skip to content

Simplify param handling in resolve_bound_vars #132043

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 2 commits into from
Oct 27, 2024

Conversation

compiler-errors
Copy link
Member

I always found the flow of the ResolvedArg constructors to be a bit confusing; turns out they're also kinda redundantly passing around their data, too.

Also, deduplicate some code handling early-bound var to late-bound var conversion between return type notation's two styles: where <T as Trait>::method(..): Bound and where T: Trait<method(..): Bound>.

@rustbot
Copy link
Collaborator

rustbot commented Oct 22, 2024

r? @wesleywiser

rustbot has assigned @wesleywiser.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 22, 2024
);
(param.def_id, ResolvedArg::LateBound(depth, idx, param.def_id))
fn late(idx: u32, param: &GenericParam<'_>) -> ResolvedArg {
ResolvedArg::LateBound(ty::INNERMOST, idx, param.def_id)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we just get rid of those constructors?

Copy link
Member Author

@compiler-errors compiler-errors Oct 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could do so, but having INNERMOST sprinkled around everywhere is a tiny bit annoying. I feel like it doesn't change the code much either way.

@cjgillot
Copy link
Contributor

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Oct 27, 2024

📌 Commit 1b7a91e has been approved by cjgillot

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 27, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 27, 2024
…iaskrgr

Rollup of 5 pull requests

Successful merges:

 - rust-lang#132043 (Simplify param handling in `resolve_bound_vars`)
 - rust-lang#132214 (Cleanup: Move an impl-Trait check from AST validation to AST lowering)
 - rust-lang#132221 (Clean up some comments on lint implementation)
 - rust-lang#132228 (Revert "ci update freebsd version proposal, freebsd 12 being eol.")
 - rust-lang#132234 (Miri subtree update)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 60beb59 into rust-lang:master Oct 27, 2024
6 checks passed
@rustbot rustbot added this to the 1.84.0 milestone Oct 27, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Oct 27, 2024
Rollup merge of rust-lang#132043 - compiler-errors:simplify-rbv, r=cjgillot

Simplify param handling in `resolve_bound_vars`

I always found the flow of the `ResolvedArg` constructors to be a bit confusing; turns out they're also kinda redundantly passing around their data, too.

Also, deduplicate some code handling early-bound var to late-bound var conversion between return type notation's two styles: `where <T as Trait>::method(..): Bound` and `where T: Trait<method(..): Bound>`.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants