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

rustdoc: Remove fake_def_ids RefCell #82382

Merged
merged 1 commit into from
Feb 22, 2021

Conversation

camelid
Copy link
Member

@camelid camelid commented Feb 22, 2021

No description provided.

@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 Feb 22, 2021
@rust-highfive
Copy link
Collaborator

r? @GuillaumeGomez

(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 Feb 22, 2021
@camelid
Copy link
Member Author

camelid commented Feb 22, 2021

This may be worth a perf run since I had to remove the use of the Entry API due to borrowck errors, and as a result I think it will hash the CrateNum more times.

@camelid camelid force-pushed the remove-fake_def_ids-refcell branch from f426c86 to 0b19770 Compare February 22, 2021 01:55
@rust-log-analyzer

This comment has been minimized.

@jyn514
Copy link
Member

jyn514 commented Feb 22, 2021

r? @jyn514

src/librustdoc/core.rs Outdated Show resolved Hide resolved
@jyn514 jyn514 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-review Status: Awaiting review from the assignee but also interested parties. labels Feb 22, 2021
@camelid camelid force-pushed the remove-fake_def_ids-refcell branch from 0b19770 to 82c58b9 Compare February 22, 2021 02:26
@camelid camelid added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 22, 2021
@jyn514
Copy link
Member

jyn514 commented Feb 22, 2021

This may be worth a perf run since I had to remove the use of the Entry API due to borrowck errors, and as a result I think it will hash the CrateNum more times.

Can you post the error you get if you use entry instead? I'd prefer to keep using it if possible.

@jyn514 jyn514 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-review Status: Awaiting review from the assignee but also interested parties. labels Feb 22, 2021
@camelid
Copy link
Member Author

camelid commented Feb 22, 2021

This may be worth a perf run since I had to remove the use of the Entry API due to borrowck errors, and as a result I think it will hash the CrateNum more times.

Can you post the error you get if you use entry instead? I'd prefer to keep using it if possible.

error[E0502]: cannot borrow `*self` as immutable because it is also borrowed as mutable
   --> src/librustdoc/core.rs:150:25
    |
144 |         let def_index = match self.fake_def_ids.entry(crate_num) {
    |                               ----------------- mutable borrow occurs here
...
150 |                         self.enter_resolver(|r| r.cstore().num_def_ids(crate_num))
    |                         ^^^^ immutable borrow occurs here
...
159 |                 e.insert(num_def_idx)
    |                 - mutable borrow later used here

@jyn514
Copy link
Member

jyn514 commented Feb 22, 2021

You can fix that by not going through the enter_resolver wrapper:

self.resolver.borrow_mut().access(|r| r.cstore().num_def_ids(crate_num))

@camelid camelid force-pushed the remove-fake_def_ids-refcell branch from 82c58b9 to 45673e2 Compare February 22, 2021 02:47
@camelid camelid added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 22, 2021
@jyn514
Copy link
Member

jyn514 commented Feb 22, 2021

r=me with CI passing (remember to use r=jyn514)

@jyn514
Copy link
Member

jyn514 commented Feb 22, 2021

@bors r+

@bors
Copy link
Contributor

bors commented Feb 22, 2021

📌 Commit 45673e2 has been approved by jyn514

@bors bors removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 22, 2021
@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Feb 22, 2021
@camelid
Copy link
Member Author

camelid commented Feb 22, 2021

Since this may have perf implications: @bors rollup=never

@jyn514
Copy link
Member

jyn514 commented Feb 22, 2021

Personally given how little perf impact #82305 had, I don't think this needs to be marked as rollup=never, especially since it only affects rustdoc and not rustc.

@bors rollup=maybe

bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 22, 2021
Rollup of 9 pull requests

Successful merges:

 - rust-lang#82098 (Add internal `collect_into_array[_unchecked]` to remove duplicate code)
 - rust-lang#82228 (Provide NonZero_c_* integers)
 - rust-lang#82287 (Make "missing field" error message more natural)
 - rust-lang#82351 (Use the first paragraph, instead of cookie-cutter text, for rustdoc descriptions)
 - rust-lang#82353 (rustdoc: Remove unnecessary `Cell` around `param_env`)
 - rust-lang#82367 (remove redundant option/result wrapping of return values)
 - rust-lang#82372 (improve UnsafeCell docs)
 - rust-lang#82379 (Fix sizes of repr(C) enums on hexagon)
 - rust-lang#82382 (rustdoc: Remove `fake_def_ids` RefCell)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 86940be into rust-lang:master Feb 22, 2021
@rustbot rustbot added this to the 1.52.0 milestone Feb 22, 2021
@camelid camelid deleted the remove-fake_def_ids-refcell branch February 22, 2021 17:55
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. 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.

7 participants