Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Refactor find_*_stability functions #109539

Merged
merged 3 commits into from
Mar 25, 2023
Merged

Conversation

cjgillot
Copy link
Contributor

The idea is to split the monolithic function into the 3 cases: stability, const stability, and body stability.

@rustbot
Copy link
Collaborator

rustbot commented Mar 23, 2023

r? @b-naber

(rustbot has picked a reviewer for you, use r? to override)

@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 Mar 23, 2023
Copy link
Contributor

@b-naber b-naber left a comment

Choose a reason for hiding this comment

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

Looks a lot better. r=me with or without the nits.

}
}
}
/// Collects stability info from all stability attributes in `attrs`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we update these comments or remove the first sentence? I feel that in their current form these aren't really helpful.

body_stab
}

fn parse_stability(sess: &Session, attr: &Attribute) -> Option<(Symbol, StabilityLevel)> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe add a brief doc comment for these?

fn parse_stability(sess: &Session, attr: &Attribute) -> Option<(Symbol, StabilityLevel)> {
let meta = attr.meta()?;
let MetaItem { kind: MetaItemKind::List(ref metas), .. } = meta else { return None };
let insert = |meta: &MetaItem, item: &mut Option<Symbol>| {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe choose a more expressive name for this closure?

@b-naber
Copy link
Contributor

b-naber commented Mar 24, 2023

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Mar 24, 2023

📌 Commit 3e9ea5d has been approved by b-naber

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 Mar 24, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 25, 2023
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#109355 (Fix bad suggestion for clone/is_some in field init shorthand)
 - rust-lang#109484 (Bugfix: avoid panic on invalid json output from libtest)
 - rust-lang#109539 (Refactor `find_*_stability` functions)
 - rust-lang#109542 (rustdoc: clean up `storage.js`)
 - rust-lang#109545 (Deeply check well-formedness of return-position `impl Trait` in trait)
 - rust-lang#109568 (miri: fix raw pointer dyn receivers)
 - rust-lang#109570 (Add GUI test for "Auto-hide item methods' documentation" setting)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 15ea227 into rust-lang:master Mar 25, 2023
@rustbot rustbot added this to the 1.70.0 milestone Mar 25, 2023
@cjgillot cjgillot deleted the find-stability branch March 25, 2023 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in 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.

4 participants