about summary refs log tree commit diff
path: root/src/librustdoc
AgeCommit message (Collapse)AuthorLines
2025-09-25rustdoc: Slightly clean up attr renderingLeón Orell Valerian Liehr-97/+56
2025-09-24Rollup merge of #146897 - lolbinarycat:rustdoc-invalid_html_tags-ice-146890, ↵Matthias Krüger-1/+2
r=GuillaumeGomez fix ICE in rustdoc::invalid_html_tags fixes https://github.com/rust-lang/rust/issues/146890 r? ```@GuillaumeGomez```
2025-09-24rustdoc-search: stringdex update with more packingMichael Howell-28/+52
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-22fix ICE in rustdoc::invalid_html_tagsbinarycat-1/+2
2025-09-22Rollup merge of #146828 - el-ev:issue146646, r=GuillaumeGomezGuillaume Gomez-2/+4
fix a crash in rustdoc merge finalize without input file - Closes rust-lang/rust#146646 `SerializedSearchIndex::union` calls `Symbol::intern`, requiring `SESSION_GLOBALS` to be set.
2025-09-22Rollup merge of #146838 - yotamofek:pr/rustdoc/wrappers, r=lolbinarycatStuart Cook-251/+262
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-238/+248
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-22/+25
Co-authored-by: Anne Stijns <anstijns@gmail.com>
2025-09-21fix a crash in rustdoc merge finalize without input fileIris Shi-2/+4
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-18Rollup merge of #146664 - fmease:clean-up-dyn, r=jdonszelmannStuart Cook-1/+1
Clean up `ty::Dynamic` 1. As a follow-up to PR rust-lang/rust#143036, remove `DynKind` entirely. 2. Inside HIR ty lowering, consolidate modules `dyn_compatibility` and `lint` into `dyn_trait` * `dyn_compatibility` wasn't about dyn compatibility itself, it's about lowering trait object types * `lint` contained dyn-Trait-specific diagnostics+lints only
2025-09-17Remove ImplSubjectCameron Steffen-5/+5
2025-09-17Cleanup `FnDecl::inner_full_print`Yotam Ofek-51/+62
2025-09-17Remove `DynKind`León Orell Valerian Liehr-1/+1
2025-09-14rustdoc: Move HTML-specific attr rendering code into HTML rendering modLeón Orell Valerian Liehr-150/+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-12Don't store defaultness for inherent impl itemsCameron Steffen-2/+5
2025-09-12Split AssocContainer::{InherentImpl,TraitImpl}Cameron Steffen-29/+24
2025-09-12Rename AssocItemContainer -> AssocContainerCameron Steffen-14/+14
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-12Rollup merge of #146448 - GuillaumeGomez:fix-literal-search-paths, ↵Stuart Cook-2/+4
r=lolbinarycat [rustdoc] Correctly handle literal search on paths Fixes https://github.com/rust-lang/rust/issues/146129. cc ```@notriddle``` r? ```@lolbinarycat```
2025-09-12Rollup merge of #146413 - GuillaumeGomez:rustdoc-bare-urls, r=lolbinarycatStuart Cook-18/+39
Improve suggestion in case a bare URL is surrounded by brackets Fixes https://github.com/rust-lang/rust/issues/146162. With this change, output looks like this: ``` | 1 | //! [https://github.com] | ^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `<https://github.com>` | = note: bare URLs are not automatically turned into clickable links = note: `#[warn(rustdoc::bare_urls)]` on by default ``` cc ```@fmease``` r? ```@lolbinarycat```
2025-09-11Correctly handle literal search on pathsGuillaume Gomez-2/+4
2025-09-10Rollup merge of #146340 - fmease:frontmatter-containment, r=fee1-dead,UrgauMatthias Krüger-16/+24
Strip frontmatter in fewer places * Stop stripping frontmatter in `proc_macro::Literal::from_str` (RUST-146132) * Stop stripping frontmatter in expr-ctxt (but not item-ctxt!) `include`s (RUST-145945) * Stop stripping shebang (!) in `proc_macro::Literal::from_str` * Not a breaking change because it did compare spans already to ensure there wasn't extra whitespace or comments (`Literal::from_str("#!\n0")` already yields `Err(_)` thankfully!) * Stop stripping frontmatter+shebang inside some rustdoc code where it doesn't make any observable difference (see self review comments) * (Stop stripping frontmatter+shebang inside internal test code) Fixes https://github.com/rust-lang/rust/issues/145945. Fixes https://github.com/rust-lang/rust/issues/146132. r? fee1-dead
2025-09-10Simplify code for `find_raw_urls`Guillaume Gomez-17/+11
2025-09-10Improve suggestion in case a bare URL is surrounded by bracketsGuillaume Gomez-13/+40
2025-09-09Strip frontmatter in fewer placesLeón Orell Valerian Liehr-16/+24
2025-09-08mark `format_args_nl!` as `#[doc(hidden)]`cyrgani-2/+1
2025-09-04Auto merge of #145911 - notriddle:stringdex-tweak-3, r=GuillaumeGomezbors-162/+645
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-162/+645
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-04Rollup merge of #146161 - GuillaumeGomez:loaded-paths-scraped-examples, ↵Stuart Cook-6/+4
r=lolbinarycat [rustdoc] Uncomment code to add scraped rustdoc examples in loaded paths Since the bug was fixed in https://github.com/rust-lang/rust/pull/146091, we can now uncomment the code. :) r? lolbinarycat
2025-09-04Rollup merge of #146150 - weihanglo:rustdoc-emit, r=aDotInTheVoidStuart Cook-2/+9
fix(rustdoc): match rustc `--emit` precedence Resolves rust-lang/rust#141664 This changes rustdoc's `--emit` to allow only one instance of each type, regardless of the actual data that `--emit` carries. This matches rustc's `--emit` behavior. As of the writing, only `dep-info` emit type carries extra data.
2025-09-03Uncomment code to add scraped rustdoc examples in loaded pathsGuillaume Gomez-6/+4
2025-09-03fix(rustdoc): match rustc `--emit` precedenceWeihang Lo-2/+9
Change rustdoc's `--emit` to allow only one instance of each type, regardless of the actual data that `--emit` carries. This matches rustc's `--emit` behavior. As of the writing, only `dep-info` emit type carries extra data. See <https://github.com/rust-lang/rust/issues/141664>
2025-09-02Rollup merge of #146117 - GuillaumeGomez:fix-search-index-generation, ↵Guillaume Gomez-55/+41
r=notriddle Fix search index generation Fixes this issue: ``` error: couldn't generate documentation: failed to read column from disk: data consumer error: missing field `unknown number` at line 1 column 8 | = note: failed to create or modify "build/x86_64-unknown-linux-gnu/test/rustdoc-gui/doc/search.index/entry/": failed to read column from disk: data consumer error: missing field `unknown number` at line 1 column 8 warning: `theme_css` (lib doc) generated 1 warning error: could not document `theme_css` ``` The problem was that a conversion was forgotten for the `ItemType` enum. Thanks a lot to `@janis-bhm!` r? `@lolbinarycat`
2025-09-02Rollup merge of #146102 - fmease:rm-dead-eff-code-iii, r=fee1-deadGuillaume Gomez-6/+4
Remove dead code stemming from an old effects desugaring CC https://github.com/rust-lang/rust/pull/132374, https://github.com/rust-lang/rust/pull/133443. r? fee1-dead
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-02Rollup merge of #146070 - notriddle:skip-loading-function-data, r=GuillaumeGomezGuillaume Gomez-12/+13
rustdoc-search: skip loading unneeded fnData Fixes rust-lang/rust#146063 (probably) Based on the test I ran, it seems like most of the CPU time is being spent loading function signature data. This PR should avoid that. https://notriddle.com/rustdoc-html-demo-12/skip-loading-function-data/doc/std/index.html
2025-09-02Make it impossible to forget a conversion for the rustdoc `ItemType` enumGuillaume Gomez-55/+40
2025-09-02Fix `unknown number` error when generating search indexGuillaume Gomez-2/+3
2025-09-02Revert introduction of `[workspace.dependencies]`.Nicholas Nethercote-5/+5
This was done in #145740 and #145947. It is causing problems for people using r-a on anything that uses the rustc-dev rustup package, e.g. Miri, clippy. This repository has lots of submodules and subtrees and various different projects are carved out of pieces of it. It seems like `[workspace.dependencies]` will just be more trouble than it's worth.