about summary refs log tree commit diff
path: root/src/librustdoc/html
AgeCommit message (Collapse)AuthorLines
2025-10-03Auto merge of #145898 - lolbinarycat:rustdoc-search-trait-parent, ↵bors-49/+174
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-02search.js: introduce optimized removeIdxListAsc routinebinarycat-9/+30
2025-10-02if a trait item is shown in search results, hide the impl itembinarycat-50/+154
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-30Replace `rustc_span::Span` with a stripped down version for librustdoc's ↵Yotam Ofek-18/+65
highlighter
2025-09-30Add `#[bench]` for librustdoc's syntax highlighterYotam Ofek-0/+14
2025-09-28Auto merge of #147002 - notriddle:stringdex3, r=GuillaumeGomezbors-27/+51
rustdoc-search: stringdex update with more packing Before: 18M build/x86_64-unknown-linux-gnu/doc/search.index/ 57M build/x86_64-unknown-linux-gnu/compiler-doc/search.index/ After: 16M build/x86_64-unknown-linux-gnu/doc/search.index/ 49M build/x86_64-unknown-linux-gnu/compiler-doc/search.index/ CC rust-lang/rust#146063
2025-09-28Auto merge of #147118 - matthiaskrgr:rollup-4yqmoyr, r=matthiaskrgrbors-116/+89
Rollup of 14 pull requests Successful merges: - rust-lang/rust#142139 (Include additional hashes in src/stage0) - rust-lang/rust#146745 (Clarified error note for usize range matching) - rust-lang/rust#146763 (cg_llvm: Replace some DIBuilder wrappers with LLVM-C API bindings (part 5)) - rust-lang/rust#146788 (chore: removes deprecated discord.) - rust-lang/rust#146942 ([rustdoc] Finish getting rid of usages `write_str`) - rust-lang/rust#147061 (fix rebasing cycle heads when not reaching a fixpoint) - rust-lang/rust#147066 (Fix tracking issue number for feature(macro_attr)) - rust-lang/rust#147081 (doc: fix a typo in platform-support.md) - rust-lang/rust#147082 (formatting_options: fix alternate docs 0b/0o mixup) - rust-lang/rust#147086 (compiletest: Use `PanicHookInfo::payload_as_str` now that it's stable in beta) - rust-lang/rust#147093 (redox: switch to colon as path separator) - rust-lang/rust#147095 (Library: Remove remaining private `#[repr]` workarounds) - rust-lang/rust#147098 (Add auto extra-checks in pre-push hook) - rust-lang/rust#147110 (Fix typo) r? `@ghost` `@rustbot` modify labels: rollup
2025-09-28Rollup merge of #146942 - yotamofek:pr/rustdoc/finish_deprecating_write_str, ↵Matthias Krüger-116/+89
r=GuillaumeGomez [rustdoc] Finish getting rid of usages `write_str` This PR, along with rust-lang/rust#146933 , get rid of all the last usages of the `write_str` fn that was introduced back in rust-lang/rust#136784 . This *shouldn't* be rolled up along with rust-lang/rust#146933 , since the later of the two to be merged will need to delete the no-longer-used `write_str` fn. Commits can be reviewed separately.
2025-09-28Auto merge of #147045 - notriddle:search-index-entrydata-path, r=GuillaumeGomezbors-8/+32
rustdoc-search: use the same ID for entry and path to same item This decreases the size of the compiler-doc from 57MiB to 56MiB. r? `@GuillaumeGomez`
2025-09-26Simplify notable traits map serializationYotam Ofek-19/+4
2025-09-26Cleanup `notable_traits_decl`Yotam Ofek-56/+63
2025-09-26Remove usages of `write_str` from `render_assoc_items_inner`Yotam Ofek-41/+22
2025-09-26Rollup merge of #147047 - notriddle:toolbar-index, r=GuillaumeGomezMatthias Krüger-3/+13
rustdoc: put the toolbar on the all item index
2025-09-25rustdoc-search: add descriptive comment to space-saving hackMichael Howell-0/+8
2025-09-25rustdoc: put the toolbar on the all item indexMichael Howell-3/+13
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-25Auto merge of #147037 - matthiaskrgr:rollup-xtgqzuu, r=matthiaskrgrbors-229/+378
Rollup of 8 pull requests Successful merges: - rust-lang/rust#116882 (rustdoc: hide `#[repr]` if it isn't part of the public ABI) - rust-lang/rust#135771 ([rustdoc] Add support for associated items in "jump to def" feature) - rust-lang/rust#141032 (avoid violating `slice::from_raw_parts` safety contract in `Vec::extract_if`) - rust-lang/rust#142401 (Add proper name mangling for pattern types) - rust-lang/rust#146293 (feat: non-panicking `Vec::try_remove`) - rust-lang/rust#146859 (BTreeMap: Don't leak allocators when initializing nodes) - rust-lang/rust#146924 (Add doc for `NonZero*` const creation) - rust-lang/rust#146933 (Make `render_example_with_highlighting` return an `impl fmt::Display`) r? `@ghost` `@rustbot` modify labels: rollup
2025-09-25Rollup merge of #146933 - yotamofek:pr/rustdoc/highlight_no_write_str, ↵Matthias Krüger-95/+80
r=GuillaumeGomez Make `render_example_with_highlighting` return an `impl fmt::Display` Removes some more usages of `write_str`. Shouldn't affect runtime, but makes the codebase a bit more consistent. Each commit can be reviewed separately
2025-09-25Rollup merge of #135771 - GuillaumeGomez:jump-to-def-perf, r=fmeaseMatthias Krüger-92/+152
[rustdoc] Add support for associated items in "jump to def" feature Fixes https://github.com/rust-lang/rust/issues/135485. r? ``@fmease``
2025-09-25Rollup merge of #116882 - fmease:rustdoc-generalized-priv-repr-heuristic, ↵Matthias Krüger-42/+146
r=rustdoc rustdoc: hide `#[repr]` if it isn't part of the public ABI > [!IMPORTANT] > Temporarily stacked on top of PR https://github.com/rust-lang/rust/pull/146527; only the last commit is relevant! Follow-up to rust-lang/rust#115439. Unblocks rust-lang/rust#116743, CC ``@dtolnay.`` Fixes rust-lang/rust#66401. Fixes rust-lang/rust#128364. Fixes rust-lang/rust#137440. Only display the representation `#[repr(REPR)]` (where `REPR` is not `Rust` or `transparent`) of a given type if none of its variants (incl. the synthetic variants of structs) are `#[doc(hidden)]` and all of its fields are public and not `#[doc(hidden)]` since it's likely not meant to be considered part of the public ABI otherwise. `--document-{private,hidden}-items` works as expected in this context, too. Moreover, we now also factor in the presence of `#[doc(hidden)]` when checking whether to show `repr(transparent)` or not.
2025-09-25Rollup merge of #146667 - calebzulawski:simd-mono-lane-limit, r=lcnr,RalfJungStuart Cook-0/+5
Add an attribute to check the number of lanes in a SIMD vector after monomorphization Allows std::simd to drop the `LaneCount<N>: SupportedLaneCount` trait and maintain good error messages. Also, extends rust-lang/rust#145967 by including spans in layout errors for all ADTs. r? ``@RalfJung`` cc ``@workingjubilee`` ``@programmerjake``
2025-09-25rustdoc: hide `#[repr(...)]` if it isn't part of the public ABILeón Orell Valerian Liehr-21/+61
2025-09-25rustdoc: Fully escape link section and export nameLeón Orell Valerian Liehr-2/+2
Escape "special characters" (e.g., double quotes `"` and line breaks `\n`). Escape HTML. Lastly, add regression tests and clean up existing tests.
2025-09-25rustdoc: Slightly clean up attr renderingLeón Orell Valerian Liehr-97/+56
2025-09-24rustdoc-search: stringdex update with more packingMichael Howell-27/+51
Before: 18M build/x86_64-unknown-linux-gnu/doc/search.index/ 57M build/x86_64-unknown-linux-gnu/compiler-doc/search.index/ After: 16M build/x86_64-unknown-linux-gnu/doc/search.index/ 49M build/x86_64-unknown-linux-gnu/compiler-doc/search.index/
2025-09-23Add an attribute to check the number of lanes in a SIMD vector after ↵Caleb Zulawski-0/+5
monomorphization Unify zero-length and oversized SIMD errors
2025-09-23Rollup merge of #146877 - el-ev:issue146816, ↵Matthias Krüger-7/+18
r=fmease,lolbinarycat,GuillaumeGomez prevent line number from being copied in chrome - Closes rust-lang/rust#146816 Fix the issue where line numbers are copied along with code in Chrome
2025-09-23Remove unused param from `write_header`Yotam Ofek-11/+2
2025-09-23Remove `Tooltip::None` variant, use `Option::None`Yotam Ofek-25/+28
2025-09-23Make `render_example_with_highlighting` return an `impl fmt::Display`Yotam Ofek-71/+62
2025-09-23prevent line number from being copied in chromeIris Shi-7/+18
2025-09-22Rollup merge of #146838 - yotamofek:pr/rustdoc/wrappers, r=lolbinarycatStuart Cook-202/+146
Introduce "wrapper" helpers to rustdoc Add a few traits for streamlining places where we need to wrap certain `fmt::Display`s in stuff like parentheses or brackets. Hopefully this makes the actual display logic slightly easier to read. First two commits are small, unrelated cleanups. I'll probably add some doc comments to the stuff in `display.rs`, maybe also play around with the API, but wanted to get feedback on this idea first.
2025-09-22Introduce "wrapper" helpers to rustdocYotam Ofek-189/+132
2025-09-21Re-use some existing util fnsYotam Ofek-9/+7
2025-09-21Early return in `visibility_print_with_space`Yotam Ofek-4/+7
2025-09-21Port #[macro_export] to the new attribute parsing infrastructureJonathan Brouwer-10/+13
Co-authored-by: Anne Stijns <anstijns@gmail.com>
2025-09-19Rollup merge of #146484 - notriddle:stringdex-js-opt, r=GuillaumeGomezStuart Cook-140/+290
rustdoc-search: JavaScript optimization based on Firefox Profiler output Part of https://github.com/rust-lang/rust/issues/146048 Preview: https://notriddle.com/rustdoc-html-demo-12/stringdex-js-opt/std/index.html These commits are based on some profiler readings, and should reduce CPU usage for name-based searching. - The first commit improves warm searches by allocating less garbage when data is already loaded: Before: https://profiler.firefox.com/public/wvzd88m8r70p8frvz1z628tv3htwna0b9c0ef10/calltree/?globalTrackOrder=0w2&implementation=js&thread=3&v=11 After: https://profiler.firefox.com/public/yfe9aq6ep3kacw3zmr7jqn6gv7ckfq86rg89568/calltree/?globalTrackOrder=0w2&implementation=js&thread=3&v=11 - The second commit improves cold searches by delaying load for special type names until type-based search runs Before: 5.86s (throttled to "Good 2G" in Dev Tools) <https://doc.rust-lang.org/nightly/std/index.html?search=> <img width="2524" height="919" alt="image" src="https://github.com/user-attachments/assets/8dbbbd46-b7ab-4e3c-9e8c-f1e41cfaa968" /> After: 5.77s (throttled to "Good 2G" in Dev Tools) <https://notriddle.com/rustdoc-html-demo-12/stringdex-js-opt/std/index.html?search=> <img width="2524" height="912" alt="image" src="https://github.com/user-attachments/assets/6976a584-24f4-4d47-8118-7a81b22d411e" /> For comparison's sake, the same test takes 12.17s on stable <https://doc.rust-lang.org/1.89.0/std/index.html?search=> <img width="2525" height="916" alt="image" src="https://github.com/user-attachments/assets/eb6df2e8-6632-4bef-a6d0-5179c6288fd0" />
2025-09-18Rollup merge of #146694 - camsteffen:impl-subject, r=compiler-errorsStuart Cook-5/+5
Remove ImplSubject It only has one usage in rustdoc.
2025-09-17Remove ImplSubjectCameron Steffen-5/+5
2025-09-17Cleanup `FnDecl::inner_full_print`Yotam Ofek-48/+59
2025-09-14rustdoc: Move HTML-specific attr rendering code into HTML rendering modLeón Orell Valerian Liehr-38/+143
These functions used to be shared with the JSON backend but nowadays they aren't.
2025-09-12rustdoc-search: delay loading type name IDs until type searchMichael Howell-90/+233
This avoids blocking on these lookups, so name-based searches return results more quickly.
2025-09-12rustdoc-search: reduce async machinery in value lookupsMichael Howell-50/+57
This commit is a mirrored change from stringdex that makes `at()` not always return a promise, which is fine because we can still `await` it.
2025-09-11Correctly handle literal search on pathsGuillaume Gomez-2/+4
2025-09-08mark `format_args_nl!` as `#[doc(hidden)]`cyrgani-1/+1
2025-09-04Auto merge of #145911 - notriddle:stringdex-tweak-3, r=GuillaumeGomezbors-161/+644
rustdoc-search: yet another stringdex optimization attempt This one's uses a different tactic. It shouldn't significantly increase the amount of downloaded index data, but still reduces the amount of disk usage. This one works by changing the suffix-only node representation to omit some data that's needed for checking. Since those nodes make up the bulk of the tree, it reduces the data they store, but also requires validating the match by fetching the name itself (but the names list is pretty small, and when I tried it with wordnet "indexing" it was about the same). r? `@GuillaumeGomez`
2025-09-03rustdoc-search: yet another stringdex optimization attemptMichael Howell-161/+644
This one's uses a different tactic. It shouldn't significantly increase the amount of downloaded index data, but still reduces the amount of disk usage. This one works by changing the suffix-only node representation to omit some data that's needed for checking. Since those nodes make up the bulk of the tree, it reduces the data they store, but also requires validating the match by fetching the name itself (but the names list is pretty small, and when I tried it with wordnet "indexing" it was about the same).
2025-09-02Rollup merge of #146091 - janis-bhm:rustdoc-default-span-with-simple-test, ↵Guillaume Gomez-15/+37
r=GuillaumeGomez fix rustdoc `render_call_locations` panicking because of default span `DUMMY_SP` pointing at non local-source file fixes https://github.com/rust-lang/rust/issues/144752 related to/builds on https://github.com/rust-lang/rust/pull/145008 bevy still crashes in the same way as rust-lang/rust#144752 when building docs on nightly, and from what I can tell the cause seems to be the following (copied from zulip [#t-rustdoc > docs on nightly with example scrapes crash](https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/docs.20on.20nightly.20with.20example.20scrapes.20crash)): > render_call_locations tries to [find](https://github.com/rust-lang/rust/blob/84a17470220e7adf249b18d7c0178dfbede89462/src/librustdoc/html/render/mod.rs#L2816) the source span of a call to add as an example, but the example files are never actually in the source map from what I can tell, and so it falls back to the default span, which points at the first file in the source map. > Now, the issue that guillaume mentions [here](https://github.com/rust-lang/rust/pull/145008) adds new files to the source map in order to get them into the dep info, and that leads to some files, namely docs-rs/trait-tags.html in the case of bevy because it's added with --html-after-content, being added before any source files, so then the default span points at them, and when href_from_span tries to find the [source file](https://github.com/rust-lang/rust/blob/84a17470220e7adf249b18d7c0178dfbede89462/src/librustdoc/html/render/context.rs#L368) corresponding to the span, the file doesn't belong to local_sources, and it short circuits. > This can be fixed by just not using DUMMY_SP as the default span and calculating, for example, the crates root source file as the span, because I'm not entirely sure what the href from that span is actually used for; it's not what links to the example in the end. > I think the proper way of fixing this would be to make sure the example files are part of the local_sources or at least the source map, but I don't know nearly enough about rust internals to be able to figure out how to fix that. I've included a test that's mostly copied from rust-lang/rust#145008's test with the addition of `--html-after-content after.html` in the `RUSTDOCFLAGS`, which panics on master in conjunction with the `-Zrustdoc-scrape-examples` cargo flag. cc `@GuillaumeGomez`
2025-09-02squash fix `render_call_locations` panic when default span points at file ↵Janis-15/+37
outside of local_sources add test against crashing with --html-after-content file correctly add --html-after-content to env not args formatting fix for rustdoc-call-locations-after-content/rmake.rs Use local crate source file as default span in `render_call_locations` - avoids unwrapping the first file added to the source map as a local file in `href_from_span` move test to tests/rustdoc-gui, rename to scrape_examples_ice test link is correct use rustdocflags, rename path in example, track lock file factor out duplicate function calls use compile-flags to make sure the after.html file is actually included in the rustdoc call fix goml go-to path increment assert-count in sidebar-source-code.goml adjust crate-search width in search-result-display.goml renamed Bar in scrape_examples_ice test make crate name shorter ..
2025-08-31rustdoc-search: skip loading unneeded fnDataMichael Howell-12/+13