Skip to content

Refactor configure_annotatable #133021

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 4 commits into from
Nov 15, 2024

Conversation

nnethercote
Copy link
Contributor

This PR streamlines configure_annotatable and nearby code considerably.

r? @petrochenkov

They each have a single callsite, and the result is always unwrapped, so
the `Option<Annotatable>` return type is misleading.

Also, the comment at the `configure_annotatable` call site is wrong,
talking about a result vector, so this commit also removes that.
Important: we know from the `parse_annotatable_with` call above the call
site that only some of the `Annotatable` variants are possible. The
remaining cases can be replaced with `unreachable!`.
There are two matches: one in a closure, and one vanilla one. They can
be combined and simplified by putting them in a `try` block.
@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 Nov 14, 2024
@petrochenkov
Copy link
Contributor

@bors r+

@bors
Copy link
Collaborator

bors commented Nov 15, 2024

📌 Commit 7a96ed3 has been approved by petrochenkov

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 Nov 15, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 15, 2024
…iaskrgr

Rollup of 4 pull requests

Successful merges:

 - rust-lang#132817 (Recurse into APITs in `impl_trait_overcaptures`)
 - rust-lang#133021 (Refactor `configure_annotatable`)
 - rust-lang#133045 (tests: Test pac-ret flag merging on clang with LTO)
 - rust-lang#133049 (Change Visitor::visit_precise_capturing_arg so it returns a Visitor::Result)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 6963572 into rust-lang:master Nov 15, 2024
6 checks passed
@rustbot rustbot added this to the 1.84.0 milestone Nov 15, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Nov 15, 2024
Rollup merge of rust-lang#133021 - nnethercote:refactor-configure_annotatable, r=petrochenkov

Refactor `configure_annotatable`

This PR streamlines `configure_annotatable` and nearby code considerably.

r? `@petrochenkov`
@workingjubilee
Copy link
Member

@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Nov 16, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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