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

Remove masked_crates from clean::Crate #82960

Merged
merged 1 commit into from
Mar 11, 2021
Merged

Conversation

camelid
Copy link
Member

@camelid camelid commented Mar 10, 2021

Previously, masked_crates existed both on Cache and on
clean::Crate. During cache population, the clean::Crate version was
taken and moved to Cache.

This change removes the version on clean::Crate and instead directly
mutates Cache.masked_crates to initialize it. This has the advantage
of avoiding duplication and avoiding unnecessary allocation, as well as
making the flow of information through rustdoc less confusing.

The one downside I see is that clean::utils::krate() now uses the side
effect of mutating DocContext.cache instead of returning the data
directly, but it already mutated the Cache for other things (e.g.,
deref_trait_did) so it's not really new behavior. Also,
clean::utils::krate() is only called once (and is meant to only be
called once since it performs expensive and potentially destructive
operations) so the mutation shouldn't be an issue.

Follow-up to #82018 (comment).

cc @jyn514

Previously, `masked_crates` existed both on `Cache` and on
`clean::Crate`. During cache population, the `clean::Crate` version was
`take`n and moved to `Cache`.

This change removes the version on `clean::Crate` and instead directly
mutates `Cache.masked_crates` to initialize it. This has the advantage
of avoiding duplication and avoiding unnecessary allocation, as well as
making the flow of information through rustdoc less confusing.

The one downside I see is that `clean::utils::krate()` now uses the side
effect of mutating `DocContext.cache` instead of returning the data
directly, but it already mutated the `Cache` for other things (e.g.,
`deref_trait_did`) so it's not really new behavior. Also,
`clean::utils::krate()` is only called once (and is meant to only be
called once since it performs expensive and potentially destructive
operations) so the mutation shouldn't be an issue.
@camelid camelid added C-cleanup Category: PRs that clean code up or issues documenting cleanup. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Mar 10, 2021
@rust-highfive
Copy link
Collaborator

r? @ollie27

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 10, 2021
@camelid
Copy link
Member Author

camelid commented Mar 10, 2021

r? @jyn514

@rust-highfive rust-highfive assigned jyn514 and unassigned ollie27 Mar 10, 2021
@jyn514
Copy link
Member

jyn514 commented Mar 10, 2021

r=me with CI passing. Good catch, thanks :)

@camelid
Copy link
Member Author

camelid commented Mar 10, 2021

@bors r=jyn514 rollup

@bors
Copy link
Contributor

bors commented Mar 10, 2021

📌 Commit b7d91b0 has been approved by jyn514

@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 10, 2021
@jyn514
Copy link
Member

jyn514 commented Mar 10, 2021

@bors rollup=maybe

This could theoretically affect perf - I don't think it's worth marking it as rollup=never, but I don't think it needs to always be in a rollup.

@bors
Copy link
Contributor

bors commented Mar 10, 2021

⌛ Testing commit b7d91b0 with merge 066f01d...

@bors
Copy link
Contributor

bors commented Mar 11, 2021

☀️ Test successful - checks-actions
Approved by: jyn514
Pushing 066f01d to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Mar 11, 2021
@bors bors merged commit 066f01d into rust-lang:master Mar 11, 2021
@rustbot rustbot added this to the 1.52.0 milestone Mar 11, 2021
@camelid camelid deleted the masked_crates branch March 11, 2021 00:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-cleanup Category: PRs that clean code up or issues documenting cleanup. merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants