about summary refs log tree commit diff
path: root/src/librustdoc/formats/cache.rs
AgeCommit message (Collapse)AuthorLines
2025-10-03Auto merge of #145898 - lolbinarycat:rustdoc-search-trait-parent, ↵bors-11/+20
r=GuillaumeGomez,notriddle If a trait item appears in rustdoc search, hide the corrosponding impl items fixes rust-lang/rust#138251 cc `@notriddle`
2025-10-02if a trait item is shown in search results, hide the impl itembinarycat-11/+20
for example, if we're showing `Iterator::next`, we don't need to also show `Range::next` in the results. Co-authored-by: Michael Howell <michael@notriddle.com>
2025-09-27Implement RFC 3631Guillaume Gomez-2/+0
2025-08-28Add new `doc(attribute = "...")` attributeGuillaume Gomez-1/+2
2025-08-19Rollup merge of #139345 - smoelius:into-iter-stability, r=lcnr许杰友 Jieyou Xu (Joe)-1/+1
Extend `QueryStability` to handle `IntoIterator` implementations This PR extends the `rustc::potential_query_instability` lint to check values passed as `IntoIterator` implementations. Full disclosure: I want the lint to warn about this line (please see #138871 for why): https://github.com/rust-lang/rust/blob/aa8f0fd7163a2f23aa958faed30c9c2b77b934a5/src/librustdoc/json/mod.rs#L261 However, the lint warns about several other lines as well. Final note: the functions `get_callee_generic_args_and_args` and `get_input_traits_and_projections` were copied directly from [Clippy's source code](https://github.com/rust-lang/rust/blob/4fd8c04da0674af2c51310c9982370bfadfa1b98/src/tools/clippy/clippy_lints/src/methods/unnecessary_to_owned.rs#L445-L496).
2025-08-15rustdoc-search: search backend with partitioned suffix treeMichael Howell-4/+2
2025-08-15Extend `QueryStability` to handle `IntoIterator` implementationsSamuel Moelius-1/+1
Fix adjacent code Fix duplicate warning; merge test into `tests/ui-fulldeps/internal-lints` Use `rustc_middle::ty::FnSig::inputs` Address two review comments - https://github.com/rust-lang/rust/pull/139345#discussion_r2109006991 - https://github.com/rust-lang/rust/pull/139345#discussion_r2109058588 Use `Instance::try_resolve` Import `rustc_middle::ty::Ty` as `Ty` rather than `MiddleTy` Simplify predicate handling Add more `#[allow(rustc::potential_query_instability)]` following rebase Remove two `#[allow(rustc::potential_query_instability)]` following rebase Address review comment Update compiler/rustc_lint/src/internal.rs Co-authored-by: lcnr <rust@lcnr.de>
2025-08-14Revert "rustdoc search: prefer stable items in search results"Guillaume Gomez-1/+0
This reverts commit 1140e90074b0cbcfdea8535e4b51877e2838227e.
2025-08-14Revert "rustdoc: IndexItem::{stability -> is_unstable}"Guillaume Gomez-1/+1
This reverts commit 5e8ebd5ecd8546591a6707ac9e1a3b8a64c72f76.
2025-08-09Rollup merge of #141658 - lolbinarycat:rustdoc-search-stability-rank-138067, ↵Stuart Cook-0/+1
r=GuillaumeGomez rustdoc search: prefer stable items in search results fixes https://github.com/rust-lang/rust/issues/138067 this does add a new field to the search index, but since we're only listing unstable items instead of adding a boolean flag to every item, it should only increase the search index size of sysroot crates, since those are the only ones using the `staged_api` feature, at least as far as the rust project is concerned.
2025-08-08rustdoc: IndexItem::{stability -> is_unstable}binarycat-1/+1
2025-07-31remove rustc_attr_data_structuresJana Dönszelmann-1/+1
2025-07-28Support multiple crate versions in --extern-html-root-urlKornel-7/+23
2025-07-17Improve path segment joining.Nicholas Nethercote-2/+2
There are many places that join path segments with `::` to produce a string. A lot of these use `join("::")`. Many in rustdoc use `join_with_double_colon`, and a few use `.joined("..")`. One in Clippy uses `itertools::join`. A couple of them look for `kw::PathRoot` in the first segment, which can be important. This commit introduces `rustc_ast::join_path_{syms,ident}` to do the joining for everyone. `rustc_ast` is as good a location for these as any, being the earliest-running of the several crates with a `Path` type. Two functions are needed because `Ident` printing is more complex than simple `Symbol` printing. The commit also removes `join_with_double_colon`, and `estimate_item_path_byte_length` with it. There are still a handful of places that join strings with "::" that are unchanged. They are not that important: some of them are in tests, and some of them first split a path around "::" and then rejoin with "::". This fixes one test case where `{{root}}` shows up in an error message.
2025-06-10rustdoc search: prefer stable items in search resultsbinarycat-0/+1
fixes https://github.com/rust-lang/rust/issues/138067
2025-05-18Remove rustc_attr_data_structures re-export from rustc_attr_parsingmejrs-1/+1
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-2/+2
2024-12-19Rename TyAssocTypeItem -> RequiredAssocTypeItemDavid Tolnay-2/+2
2024-12-19Split AssocConstItem into ProvidedAssocConstItem and ImplAssocConstItemDavid Tolnay-3/+9
2024-12-19Rename TyAssocConstItem -> RequiredAssocConstItemDavid Tolnay-2/+2
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-2/+2
2024-09-07rustdoc: use a single box to store Attributes and ItemKindMichael Howell-11/+15
2024-08-31Rollup merge of #129774 - nnethercote:rm-extern-crate-tracing-remainder, ↵Matthias Krüger-0/+1
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/+1
2024-08-29Fix clippy lintsGuillaume Gomez-6/+6
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-1/+0
2024-07-29Reformat `use` declarations.Nicholas Nethercote-1/+2
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.