about summary refs log tree commit diff
path: root/src/librustdoc/html/render/search_index.rs
AgeCommit message (Collapse)AuthorLines
2025-10-03Auto merge of #145898 - lolbinarycat:rustdoc-search-trait-parent, ↵bors-29/+49
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-29/+49
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-25rustdoc-search: add descriptive comment to space-saving hackMichael Howell-0/+8
2025-09-25rustdoc-search: use the same ID for entry and path to same itemMichael Howell-8/+24
This decreases the size of the compiler-doc from 57MiB to 56MiB.
2025-09-21Port #[macro_export] to the new attribute parsing infrastructureJonathan Brouwer-10/+13
Co-authored-by: Anne Stijns <anstijns@gmail.com>
2025-08-30rustdoc-search: split function inverted index by input/outputMichael Howell-43/+212
With a patch applied to count the number of unifications, and running the query `Option<T>, (T -> U) -> Option<U>` before: performed unifyFunctionType on 17484 functions after: performed unifyFunctionType on 3055 functions
2025-08-21unbox raw pointers in type-based searchbinarycat-3/+6
2025-08-21make primitive:pointer work in type-based search.binarycat-2/+2
2025-08-15rustdoc-search: search backend with partitioned suffix treeMichael Howell-612/+1565
2025-08-14Revert "rustdoc search: prefer stable items in search results"Guillaume Gomez-6/+0
This reverts commit 1140e90074b0cbcfdea8535e4b51877e2838227e.
2025-08-14Revert "rustdoc: IndexItem::{stability -> is_unstable}"Guillaume Gomez-2/+2
This reverts commit 5e8ebd5ecd8546591a6707ac9e1a3b8a64c72f76.
2025-08-09Rollup merge of #141658 - lolbinarycat:rustdoc-search-stability-rank-138067, ↵Stuart Cook-0/+6
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-2/+2
2025-07-22rustdoc: avoid allocating a temp String for aliases in search indexbinarycat-3/+16
2025-07-20Rollup merge of #143988 - GuillaumeGomez:alias-inexact, r=lolbinarycatMatthias Krüger-1/+1
[rustdoc] Make aliases search support partial matching Fixes rust-lang/rust#140782. To make this work, I moved aliases into the `searchIndex` like any other item. It links to the "original" item with a new `original` field. No so great part is that we need to have some fields like `bitIndex` to be set on the alias to make the description load to work but I consider it minor enough to be ok. This PR voluntarily doesn't handle de-prioritization of aliases as ```@lolbinarycat``` wished to work on this so I'll leave them this part. :wink: cc ```@lolbinarycat```
2025-07-17Improve path segment joining.Nicholas Nethercote-7/+7
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-07-16Make aliases search support partial matchingGuillaume Gomez-1/+1
2025-06-10rustdoc search: prefer stable items in search resultsbinarycat-0/+6
fixes https://github.com/rust-lang/rust/issues/138067
2025-04-17rustdoc/clean: Change terminology of items pertaining to (formal) fn params ↵León Orell Valerian Liehr-6/+6
from "argument" to "parameter"
2025-04-15Avoid using `kw::Empty` for param names in rustdoc.Nicholas Nethercote-7/+10
2025-03-06Manual, post-`clippy --fix` cleanupsYotam Ofek-4/+1
2025-02-08Rustfmtbjorn3-4/+5
2025-01-29rustdoc: use ThinVec for generic arg partsMichael Howell-1/+1
This reduces the size of both these args, and of path segments, so should measurably help with memory use.
2025-01-16Treat other items as functions for the purpose of type-based searchbinarycat-0/+27
constants and statics are nullary functions, and struct fields are unary functions. functions (along with methods and trait methods) are prioritized over other items, like fields and constants.
2024-12-31Unsafe binder support in rustdocMichael Goulet-1/+2
2024-12-19Rename TyMethodItem -> RequiredMethodItemDavid Tolnay-1/+1
2024-12-19Rename TyAssocTypeItem -> RequiredAssocTypeItemDavid Tolnay-2/+3
2024-12-14Rollup merge of #134231 - notriddle:notriddle/mismatched-path, r=GuillaumeGomezMatthias Krüger-0/+8
rustdoc-search: fix mismatched path when parent re-exported twice
2024-12-12rustdoc-search: fix mismatched path when parent re-exported twiceMichael Howell-0/+8
2024-12-12fix self shadowed self compareklensy-1/+1
2024-11-28Fix new clippy lintsGuillaume Gomez-28/+28
2024-10-30rustdoc-search: simplify rules for generics and type paramsMichael Howell-12/+62
This commit is a response to feedback on the displayed type signatures results, by making generics act stricter. Generics are tightened by making order significant. This means `Vec<Allocator>` now matches only with a true vector of allocators, instead of matching the second type param. It also makes unboxing within generics stricter, so `Result<A, B>` only matches if `B` is in the error type and `A` is in the success type. The top level of the function search is unaffected. Find the discussion on: * <https://rust-lang.zulipchat.com/#narrow/stream/393423-t-rustdoc.2Fmeetings/topic/meeting.202024-07-08/near/449965149> * <https://github.com/rust-lang/rust/pull/124544#issuecomment-2204272265> * <https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/deciding.20on.20semantics.20of.20generics.20in.20rustdoc.20search/near/476841363>
2024-10-30rustdoc-search: add type param names to indexMichael Howell-7/+38
2024-10-25allow type-based search on foreign functionsbinarycat-1/+4
fixes https://github.com/rust-lang/rust/issues/131804
2024-10-06Handle `librustdoc` cases of `rustc::potential_query_instability` lintismailarilik-5/+5
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-6/+5
2024-09-13Rename and reorder lots of lifetimes.Nicholas Nethercote-2/+2
- Replace non-standard names like 's, 'p, 'rg, 'ck, 'parent, 'this, and 'me with vanilla 'a. These are cases where the original name isn't really any more informative than 'a. - Replace names like 'cx, 'mir, and 'body with vanilla 'a when the lifetime applies to multiple fields and so the original lifetime name isn't really accurate. - Put 'tcx last in lifetime lists, and 'a before 'b.
2024-09-07rustdoc: use a single box to store Attributes and ItemKindMichael Howell-2/+2
2024-08-30Remove `#[macro_use] extern crate tracing` from rustdoc.Nicholas Nethercote-0/+1
2024-08-22rustdoc-search: use tighter json for names and parentsMichael Howell-6/+30
File size --------- ```console $ du -hs doc.old/search-index1.82.0.js doc/search-index1.82.0.js 3.2M doc.old/search-index1.82.0.js 2.8M doc/search-index1.82.0.js $ gzip doc/search-index1.82.0.js $ gzip doc.old/search-index1.82.0.js $ du -hs doc.old/search-index1.82.0.js.gz doc/search-index1.82.0.js.gz 464K doc.old/search-index1.82.0.js.gz 456K doc/search-index1.82.0.js.gz $ du -hs compiler-doc.old/search-index.js compiler-doc/search-index.js 8.5M compiler-doc.old/search-index.js 6.5M compiler-doc/search-index.js $ gzip compiler-doc/search-index1.82.0.js $ gzip compiler-doc.old/search-index1.82.0.js $ du -hs compiler-doc.old/search-index.js.gz compiler-doc/search-index.js.gz 1.4M compiler-doc.old/search-index.js.gz 1.4M compiler-doc/search-index.js.gz ```
2024-08-07rename sortedjson -> orderedjsonEtomicBomb-5/+5
2024-08-07initial implementation of mergable rustdoc cciEtomicBomb-19/+15
2024-08-04Use `match` instead of sequence of `if let`sNoah Lev-234/+243
This is much more readable and idiomatic, and also may help performance since `match`es usually use switches while `if`s may not. I also fixed an incorrect comment.
2024-08-04rustdoc: Stop treating `Self` as a generic in search indexNoah Lev-6/+1
We already have special-cased code to handle inlining `Self` as the type or trait it refers to, and this was just causing glitches like the search `A -> B` yielding blanket `Into` impls.
2024-08-04rustdoc: Create `SelfTy` to replace `Generic(kw::SelfUpper)`Noah Lev-3/+12
Rustdoc often has to special-case `Self` because it is, well, a special type of generic parameter (although it also behaves as an alias in concrete impls). Instead of spreading this special-casing throughout the code base, create a new variant of the `clean::Type` enum that is for `Self` types. This is a refactoring that has almost no impact on rustdoc's behavior, except that `&Self`, `(Self,)`, `&[Self]`, and other similar occurrences of `Self` no longer link to the wrapping type (reference primitive, tuple primitive, etc.) as regular generics do. I felt this made more sense since users would expect `Self` to link to the containing trait or aliased type (though those are usually expanded), not the primitive that is wrapping it. For an example of the change, see the docs for `std::alloc::Allocator::by_ref`.
2024-07-29Reformat `use` declarations.Nicholas Nethercote-2/+1
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-14Fix trivial gen ident usage in toolsMichael Goulet-3/+3
2024-05-30Rename HIR `TypeBinding` to `AssocItemConstraint` and related cleanupLeón Orell Valerian Liehr-23/+23
2024-04-19rustdoc-search: add index of borrow referencesMichael Howell-23/+38
2024-04-08Update search_index.rsMichael Howell-1/+0