-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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 many RefCells from DocContext #82305
Conversation
Waiting for CI to pass and then will do perf run. |
crate resolver: Rc<RefCell<interface::BoxedResolver>>, | ||
/// Used for normalization. | ||
/// | ||
/// Most of this logic is copied from rustc_lint::late. | ||
crate param_env: Cell<ParamEnv<'tcx>>, | ||
/// Later on moved into `cache` | ||
crate renderinfo: RefCell<RenderInfo>, | ||
crate renderinfo: RenderInfo, | ||
/// Later on moved through `clean::Crate` into `cache` | ||
crate external_traits: Rc<RefCell<FxHashMap<DefId, clean::Trait>>>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left this one in because it seems the lifetimes get tricky because it's moved around.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, external_traits
is a mess: https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/Populating.20cache.20before.20intra-doc.20links
src/librustdoc/core.rs
Outdated
/// Table synthetic type parameter for `impl Trait` in argument position -> bounds | ||
crate impl_trait_bounds: RefCell<FxHashMap<ImplTraitParam, Vec<clean::GenericBound>>>, | ||
crate impl_trait_bounds: FxHashMap<ImplTraitParam, Vec<clean::GenericBound>>, | ||
crate fake_def_ids: RefCell<FxHashMap<CrateNum, DefIndex>>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left this one in because
- It would require semi-significant changes
- Ideally we're going to get rid of
fake_def_ids
at some point anyway (I think Joshua has an idea for that)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, "at some point" is probably pretty far off. But I'm fine with waiting for a follow-up PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to future readers: I was able to remove this one in #82382.
@@ -25,7 +25,7 @@ impl<'a, 'tcx> LibEmbargoVisitor<'a, 'tcx> { | |||
crate fn new(cx: &'a mut crate::core::DocContext<'tcx>) -> LibEmbargoVisitor<'a, 'tcx> { | |||
LibEmbargoVisitor { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might I say, LibEmbargoVisitor
is one of the most interesting names I've seen in rust-lang/rust
.
I've been eagerly watching the logs and the rustdoc testsuite just passed! @bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit ab1be029dc3b5d2c2efa94ad7e508172ab5617a0 with merge 42c967a8b9046d57e776497be0724b4e1b1931c7... |
☀️ Try build successful - checks-actions |
Queued 42c967a8b9046d57e776497be0724b4e1b1931c7 with parent 9b471a3, future comparison URL. |
Finished benchmarking try commit (42c967a8b9046d57e776497be0724b4e1b1931c7): comparison url. Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. Please note that if the perf results are neutral, you should likely undo the rollup=never given below by specifying Importantly, though, if the results of this run are non-neutral do not roll this PR up -- it will mask other regressions or improvements in the roll up. @bors rollup=never |
Fairly small improvements, but they're in the right direction, and it cleans up the code. |
Hmm, seems I have conflicts but bors hasn't reported yet. |
af3e95d
to
fb96100
Compare
Rebased. |
📌 Commit fb9610030cfd4596d3c1fc5074338d38b5b2661d has been approved by |
☔ The latest upstream changes (presumably #82393) made this pull request unmergeable. Please resolve the merge conflicts. |
I left some of them so this change doesn't balloon in size and because removing the RefCell in `DocContext.resolver` would require compiler changes. Thanks to `@jyn514` for making this a lot easier with rust-lang#82020!
fb96100
to
e4ac499
Compare
📌 Commit e4ac499 has been approved by |
🌲 The tree is currently closed for pull requests below priority 1000. This pull request will be tested once the tree is reopened. |
@bors rollup=iffy This only affects rustdoc's perf, not the compiler's. |
Rollup of 10 pull requests Successful merges: - rust-lang#81629 (Point out implicit deref coercions in borrow) - rust-lang#82113 (Improve non_fmt_panic lint.) - rust-lang#82258 (Implement -Z hir-stats for nested foreign items) - rust-lang#82296 (Support `pub` on `macro_rules`) - rust-lang#82297 (Consider auto derefs before warning about write only fields) - rust-lang#82305 (Remove many RefCells from DocContext) - rust-lang#82308 (Lower condition of `if` expression before it's "then" block) - rust-lang#82311 (Jsondocck improvements) - rust-lang#82362 (Fix mir-cfg dumps) - rust-lang#82391 (disable atomic_max/min tests in Miri) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
I left some of them so this change doesn't balloon in size and because
removing the RefCell in
DocContext.resolver
would require compilerchanges.
Thanks to @jyn514 for making this a lot easier with #82020!
r? @jyn514