about summary refs log tree commit diff
path: root/src/librustdoc/formats
AgeCommit message (Collapse)AuthorLines
2025-03-27Auto merge of #138927 - nnethercote:rearrange-Item-ItemInner, r=GuillaumeGomezbors-1/+0
rustdoc: Rearrange `Item`/`ItemInner`. The `Item` struct is 48 bytes and contains a `Box<ItemInner>`; `ItemInner` is 104 bytes. This is an odd arrangement. Normally you'd have one of the following. - A single large struct, which avoids the allocation for the `Box`, but can result in lots of wasted space in unused parts of a container like `Vec<Item>`, `HashSet<Item>`, etc. - Or, something like `struct Item(Box<ItemInner>)`, which requires the `Box` allocation but gives a very small Item size, which is good for containers like `Vec<Item>`. `Item`/`ItemInner` currently gets the worst of both worlds: it always requires a `Box`, but `Item` is also pretty big and so wastes space in containers. It would make sense to push it in one direction or the other. #138916 showed that the first option is a regression for rustdoc, so this commit does the second option, which improves speed and reduces memory usage. r? `@GuillaumeGomez`
2025-03-26rustdoc: Rearrange `Item`/`ItemInner`.Nicholas Nethercote-1/+0
The `Item` struct is 48 bytes and contains a `Box<ItemInner>`; `ItemInner` is 104 bytes. This is an odd arrangement. Normally you'd have one of the following. - A single large struct, which avoids the allocation for the `Box`, but can result in lots of wasted space in unused parts of a container like `Vec<Item>`, `HashSet<Item>`, etc. - Or, something like `struct Item(Box<ItemInner>)`, which requires the `Box` allocation but gives a very small Item size, which is good for containers like `Vec<Item>`. `Item`/`ItemInner` currently gets the worst of both worlds: it always requires a `Box`, but `Item` is also pretty big and so wastes space in containers. It would make sense to push it in one direction or the other. #138916 showed that the first option is a regression for rustdoc, so this commit does the second option, which improves speed and reduces memory usage.
2025-03-25rustdoc: remove useless `Symbol::is_empty` checks.Nicholas Nethercote-1/+1
There are a number of `is_empty` checks that can never fail. This commit removes them.
2025-03-06`librustdoc`: flatten nested ifsYotam Ofek-1/+3
2025-01-15allowed_through_unstable_modules: support showing a deprecation message when ↵Ralf Jung-1/+1
the unstable module name is used
2025-01-10rustdoc-json: Include items in stripped modules in `Crate::paths`.Alona Enraght-Moony-8/+15
2025-01-06rustdoc: use stable paths as preferred canonical pathsMichael Howell-1/+7
This accomplishes something like 16a4ad7d7b0d163f7be6803c786c3b83d42913bb, but with the `rustc_allowed_through_unstable_modules` attribute instead of the path length.
2024-12-27Rollup merge of #134806 - notriddle:notriddle/parent-path-is-better, ↵许杰友 Jieyou Xu (Joe)-9/+10
r=GuillaumeGomez rustdoc: use shorter paths as preferred canonical paths This is a solution to [the `std::sync::poison` linking problem](https://github.com/rust-lang/rust/pull/134692#issuecomment-2560373308), and, in general, makes intra-doc links shorter and clearer. > Done. This helped with the search, but not with the things like `MutexGuard`'s doc's reference to `Mutex::lock` being converted to the absolute (unstable) `std::sync::poison::Mutex` path. cc `@tgross35` r? `@GuillaumeGomez`
2024-12-26rustdoc: use shorter paths as preferred canonical pathsMichael Howell-9/+10
This is a solution to the `std::sync::poison` linking problem, and, in general, makes intra-doc links shorter and clearer.
2024-12-25Improve rustdoc codeGuillaume Gomez-1/+1
2024-12-19Rename TyMethodItem -> RequiredMethodItemDavid Tolnay-3/+3
2024-12-19Rename TyAssocTypeItem -> RequiredAssocTypeItemDavid Tolnay-3/+3
2024-12-19Split AssocConstItem into ProvidedAssocConstItem and ImplAssocConstItemDavid Tolnay-4/+12
2024-12-19Rename TyAssocConstItem -> RequiredAssocConstItemDavid Tolnay-3/+3
2024-12-02rustdoc: Rename set_back_info to restore_module_data.Alona Enraght-Moony-12/+13
2024-12-01Rename `FormatRenderer::InfoType` into `ModuleData` and rename ↵Guillaume Gomez-6/+6
`FormatRenderer::make_child_renderer` into `save_module_data`
2024-12-01Add documentation for new `FormatRenderer` trait itemsGuillaume Gomez-2/+24
2024-12-01Stop cloning `Context` so muchGuillaume Gomez-32/+40
2024-11-28Fix new clippy lintsGuillaume Gomez-1/+1
2024-10-06Handle `librustdoc` cases of `rustc::potential_query_instability` lintismailarilik-8/+8
2024-09-25de-rc external traitsLukas Markeffsky-1/+2
Don't keep the `external_traits` as shared mutable data between the `DocContext` and `clean::Crate`. Instead, move the data over when necessary. This allows us to get rid of a borrowck hack in the `DocVisitor`.
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-3/+3
2024-09-07rustdoc: use a single box to store Attributes and ItemKindMichael Howell-14/+18
2024-08-31Rollup merge of #129774 - nnethercote:rm-extern-crate-tracing-remainder, ↵Matthias Krüger-0/+2
r=GuillaumeGomez Remove `#[macro_use] extern crate tracing` from rustdoc and rustfmt A follow-up to #129767 and earlier PRs doing this for `rustc_*` crates. r? ```@GuillaumeGomez```
2024-08-30Remove `#[macro_use] extern crate tracing` from rustdoc.Nicholas Nethercote-0/+2
2024-08-29Rollup merge of #129743 - GuillaumeGomez:fix-rustdoc-clippy, r=notriddleGuillaume Gomez-6/+6
Fix rustdoc clippy lints Ran clippy on rustdoc and fixed the errors. r? `@notriddle`
2024-08-29Fix clippy lintsGuillaume Gomez-6/+6
2024-08-26Stop using a special inner body for the coroutine by-move body for async ↵Michael Goulet-1/+2
closures
2024-08-05Rollup merge of #128385 - its-the-shrimp:fix_114039, r=aDotInTheVoidMatthias Krüger-23/+15
rustdoc-json: discard non-local inherent impls for primitives Fixes #114039 at least it should r? `@aDotInTheVoid`
2024-08-05rustdoc-json: discard non-local inherent implsschvv31n-23/+15
2024-08-04Rollup merge of #128578 - camelid:cache-index-cleanup, r=notriddleMatthias Krüger-145/+159
rustdoc: Cleanup `CacheBuilder` code for building search index This code was very convoluted and hard to reason about. It is now (I hope) much clearer and more suitable for both future enhancements and future cleanups. I'm doing this as a precursor, with no UI changes, to changing rustdoc to [ignore blanket impls][1] in type-based search. [1]: https://github.com/rust-lang/rust/pull/128471#discussion_r1699475342 r? ``@notriddle``
2024-08-03rustdoc: Re-add missing `stripped_mod` check; explain orphan implsNoah Lev-5/+26
Co-authored-by: Michael Howell <michael@notriddle.com>
2024-08-02Restructure `add_item_to_search_index` to eliminate code pathsNoah Lev-110/+103
Many of the code paths it handled were actually impossible. In other cases, the various checks and transformations were spread around in such a way that it was hard to tell what was going on.
2024-08-02Extract local variablesNoah Lev-30/+33
2024-08-02Restructure a confusing `match`Noah Lev-62/+62
2024-08-02rustdoc: Simplify some search index codeNoah Lev-32/+28
2024-08-02rustdoc: Clarify construction of name for search indexNoah Lev-11/+14
2024-08-02rustdoc: Extract helper function to add item to search indexNoah Lev-137/+135
2024-08-01rustdoc: Remove OpaqueTyAlona Enraght-Moony-4/+1
2024-07-29Reformat `use` declarations.Nicholas Nethercote-5/+4
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-06-06Revert "Rollup merge of #124976 - petrochenkov:usedcrates, r=oli-obk"Rémy Rakic-1/+1
This reverts commit eda4a35f365535af72118118a3597edf5a13c12d, reversing changes made to eb6b35b5bcb3c2a594cb29cd478aeb2893f49d30.
2024-05-22rustc: Use `tcx.used_crates(())` moreVadim Petrochenkov-1/+1
And explain when it should be used.
2024-04-18Auto merge of #119912 - notriddle:notriddle/reexport-dedup, r=GuillaumeGomezbors-0/+12
rustdoc-search: single result for items with multiple paths Part of #15723 Preview: https://notriddle.com/rustdoc-html-demo-9/reexport-dup/std/index.html?search=hashmap This change uses the same "exact" paths as trait implementors and type alias inlining to track items with multiple reachable paths. This way, if you search for `vec`, you get only the `std` exports of it, and not the one from `alloc`. It still includes all the items in the search index so that you can search for them by all available paths. For example, try `core::option` and `std::option`, and notice that the results page doesn't show duplicates, but still shows all the items in their respective crates.
2024-04-08rustdoc-search: single result for items with multiple pathsMichael Howell-0/+12
This change uses the same "exact" paths as trait implementors and type alias inlining to track items with multiple reachable paths. This way, if you search for `vec`, you get only the `std` exports of it, and not the one from `alloc`. It still includes all the items in the search index so that you can search for them by all available paths. For example, try `core::option` and `std::option`, and notice that the results page doesn't show duplicates, but still shows all the items in their respective crates.
2024-04-04Improve code a bitGuillaume Gomez-6/+4
2024-03-12Change `DefKind::Static` to a struct variantOli Scherer-1/+1
2024-02-09Correctly generate path for non-local items in source code pagesGuillaume Gomez-12/+25
2023-11-29rustdoc: Move `AssocItemRender` and `RenderMode` to `html::render`.Alona Enraght-Moony-15/+0
They're only used for HTML, so it makes more sense for them to live their.
2023-11-26merge `DefKind::Coroutine` into `DefKind::Closure`bohan-2/+1
2023-11-25is_{some,ok}_and for rustdocMichael Goulet-4/+4