about summary refs log tree commit diff
path: root/src/librustdoc/html/render/context.rs
AgeCommit message (Collapse)AuthorLines
2021-03-24Don't call `item` on modules for json rendererNixon Enraght-Moony-0/+2
Closes #80664
2021-03-24Rollup merge of #83415 - camelid:remove-crate-module-option, r=jyn514Dylan DPC-28/+25
Remove unnecessary `Option` wrapping around `Crate.module` I'm wondering if it was originally there so that we could `take` the module which enables `after_krate` to take an `&Crate`. However, the two impls of `after_krate` only use `Crate.name`, so we can pass just the name instead.
2021-03-23Remove unnecessary `Option` wrapping around `Crate.module`Camelid-28/+25
I'm wondering if it was originally there so that we could `take` the module which enables `after_krate` to take an `&Crate`. However, the two impls of `after_krate` only use `Crate.name`, so we can pass just the name instead.
2021-03-21Rename `clean::Item.source` to `span`Camelid-5/+5
Its type is called `clean::Span`, and also the name in the rest of rustdoc and rustc for this kind of field is `span`.
2021-03-05Undo addition of boxesCamelid-7/+7
I don't think the boxing helped performance, in fact I think it potentially made it worse. The data was still being copied, but now it was through a pointer. Thinking about it more, I think boxing might only help when you're passing a big object around by value all the time, rather than the slowdown being that you're cloning it.
2021-03-05Don't unnecessarily clone some fields in `Context`Camelid-6/+15
There was no need to clone `id_map` because it was reset before each item was rendered. `deref_id_map` was not reset, but it was keyed by `DefId` and thus was unlikely to have collisions (at least for now). Now we just clone the fields that need to be cloned, and instead create fresh versions of the others.
2021-03-05Box some fields to reduce `Context` sizeCamelid-5/+5
Reduced from 152 bytes to 88 bytes.
2021-03-05Don't share `id_map` and `deref_id_map`Camelid-8/+13
All the tests passed, so it doesn't seem they need to be shared. Plus they should be item/page-specific. I'm not sure why they were shared before. I think the reason `id_map` worked as a shared value before is that it is cleared before rendering each item (in `render_item`). And then I'm guessing `deref_id_map` worked because it's a hashmap keyed by `DefId`, so there was no overlap (though I'm guessing we could have had issues in the future). Note that `id_map` currently still has to be cleared because otherwise child items would inherit the `id_map` of their parent. I'm hoping to figure out a way to stop cloning `Context`, but until then we have to reset `id_map`.
2021-03-05rustdoc: Add static size assertion for `Context`Camelid-0/+4
It's cloned a lot, so we don't want it to grow in size unexpectedly. Only run the assert on x86-64 since the size is architecture-dependent.
2021-03-05rustdoc: Make a bunch of fields privateCamelid-5/+10
Also create issue for removing shared mutable state.
2021-03-05rustdoc: Replace `Arc` around `SharedContext` with `Rc`Camelid-6/+5
It doesn't look like it's shared across threads, so it doesn't need to be thread-safe. Of course, since we're using Rust, we'll get an error if we try to share it across threads, so this should be safe :)
2021-03-05rustdoc: Move most shared fields to `SharedContext`Camelid-30/+26
...and remove `Rc`s for the moved fields. The only shared one that I didn't move was `cache`; see the doc-comment I added to `cache` for details.
2021-03-04Moved `write_shared` to its own fileNicholas-Baron-0/+1
2021-03-04Moved the `make_item_keywords` function to `context.rs` as it is only used thereNicholas-Baron-2/+6
2021-03-04Moved `print_item` and helpers to a separate fileNicholas-Baron-2/+3
2021-03-04Moved Context and its impls to a separate fileNicholas-Baron-0/+611