about summary refs log tree commit diff
path: root/src/librustdoc/html
AgeCommit message (Collapse)AuthorLines
2025-06-28Rollup merge of #142987 - lolbinarycat:rustdoc-non_exhaustive-enum-v-142599, ↵Matthias Krüger-0/+1
r=GuillaumeGomez rustdoc: show attributes on enum variants mostly for #[non_exhaustive] unsure if there's any attributes we should take care to *not* include, it could use `render_code_attribute` and `is_non_exhaustive` instead, if that is a concern. fixes rust-lang/rust#142599
2025-06-27Rollup merge of #139858 - oli-obk:new-const-traits-syntax, r=fee1-deadMatthias Krüger-1/+1
New const traits syntax This PR only affects the AST and doesn't actually change anything semantically. All occurrences of `~const` outside of libcore have been replaced by `[const]`. Within libcore we have to wait for rustfmt to be bumped in the bootstrap compiler. This will happen "automatically" (when rustfmt is run) during the bootstrap bump, as rustfmt converts `~const` into `[const]`. After this we can remove the `~const` support from the parser Caveat discovered during impl: there is no legacy bare trait object recovery for `[const] Trait` as that snippet in type position goes down the slice /array parsing code and will error r? ``@fee1-dead`` cc ``@nikomatsakis`` ``@traviscross`` ``@compiler-errors``
2025-06-27Rollup merge of #142270 - lolbinarycat:rustdoc-search-Results-type, ↵Guillaume Gomez-77/+43
r=GuillaumeGomez Rustdoc js: even more typechecking improvements I noticed some oddities when I went to start working on type aliases, so I've gone and cleaned up a bunch of stuff. Notably `fullId` was nearly always an integer in practice, but tsc was being told it should be a string. r? ``@notriddle``
2025-06-26rustdoc: show attributes on enum variantsbinarycat-0/+1
mostly for #[non_exhaustive]
2025-06-26rustdoc js: several typechecking improvmentsbinarycat-77/+43
non-exhaustive list of changes: * rustdoc.Results has a max_dist field * improve typechecking around pathDist and addIntoResults * give handleNameSearch a type signature * typecheck sortQ * currentCrate is string and not optional * searchState is referenced as a global, not through window
2025-06-26Change const trait bound syntax from ~const to [const]Oli Scherer-1/+1
2025-06-24rustdoc: Don't mark `#[target_feature]` functions as ⚠Alona Enraght-Moony-1/+2
Closes https://www.github.com/rust-lang/rust/issues/142952
2025-06-24Rollup merge of #142354 - gstjepan2:firefox_copy_paste_issue, r=GuillaumeGomezGuillaume Gomez-1/+29
Fixes firefox copy paste issue
2025-06-23Fixes firefox copy paste issuegstjepan2-1/+29
2025-06-22Port `#[no_mangle]` to new attribute parsing infrastructureJonathan Brouwer-3/+3
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-06-21Auto merge of #142667 - yotamofek:pr/rustdoc/more-write-shared-perf, ↵bors-27/+12
r=nnethercote Avoid a few more allocations in `write_shared.rs` Inspired by rust-lang/rust#141421 , avoids a few `Vec`, `PathBuf` and `String` allocations in `write_shared.rs`. I don't think these will show up on benchmarks, but are still worthwhile IMHO. Also includes a few small cleanups. r? nnethercote - if you'd like :)
2025-06-20Auto merge of #142794 - tgross35:rollup-iae7okj, r=tgross35bors-41/+41
Rollup of 9 pull requests Successful merges: - rust-lang/rust#142331 (Add `trim_prefix` and `trim_suffix` methods for both `slice` and `str` types.) - rust-lang/rust#142491 (Rework #[cold] attribute parser) - rust-lang/rust#142494 (Fix missing docs in `rustc_attr_parsing`) - rust-lang/rust#142495 (Better template for `#[repr]` attributes) - rust-lang/rust#142497 (Fix random failure when JS code is executed when the whole file was not read yet) - rust-lang/rust#142575 (Ensure copy* intrinsics also perform the static self-init checks) - rust-lang/rust#142650 (Refactor Translator) - rust-lang/rust#142713 (mbe: Refactor transcription) - rust-lang/rust#142755 (rustdoc: Remove `FormatRenderer::cache`) r? `@ghost` `@rustbot` modify labels: rollup
2025-06-20Rollup merge of #142755 - aDotInTheVoid:rdj-shattrs, r=GuillaumeGomezTrevor Gross-4/+0
rustdoc: Remove `FormatRenderer::cache` We only called it it one place, which isn't generic and can be replaced with a field access.
2025-06-20Rollup merge of #142497 - GuillaumeGomez:fix-random-search-failure, ↵Trevor Gross-37/+41
r=lolbinarycat Fix random failure when JS code is executed when the whole file was not read yet Very randomly (and rarely), when I arrived on a page with `?search=something` in the URL, I got this error: ![Screenshot From 2025-06-14 11-27-46](https://github.com/user-attachments/assets/4b61b067-4e80-49c1-9a45-cff1509bf86a) Moving the `initSearch` function at the bottom to ensure everything has been loaded fixes the issue. PS: Sorry for the noise. Pushed to the wrong branch and https://github.com/rust-lang/rust/pull/142496 closed. ><
2025-06-20Convert `ilog(10)` to `ilog10()`Chai T. Rex-1/+1
2025-06-19rustdoc: Remove `FormatRenderer::cache`Alona Enraght-Moony-4/+0
We only called it it one place, which isn't generic and can be replaced with a field access.
2025-06-19`Option`s are `Iterator`sYotam Ofek-11/+4
2025-06-19avoid intermediately collecting into vectorsYotam Ofek-8/+4
2025-06-19one less pathbuf allocationYotam Ofek-2/+2
2025-06-18`Result::expect` instead of `match` and `panic!`Yotam Ofek-6/+2
2025-06-17Rollup merge of #142618 - GuillaumeGomez:eslint-no-console, r=lolbinarycatJacob Pratt-0/+2
Lint about `console` calls in rustdoc JS As discussed [here](https://github.com/rust-lang/rust/pull/142100#discussion_r2151764395), this PR enforces that `console` is not used in rustdoc JS by default. cc `@lolbinarycat`
2025-06-17Lint about `console` calls in rustdoc JSGuillaume Gomez-0/+2
2025-06-16rustdoc: make srcIndex no longer a global variablebinarycat-28/+11
this is one-time initialization data, it can just be a function parameter. we also move the json parsing into createSrcSidebar to save a few bytes.
2025-06-16Add comment to prevent having code other than `initSearch` at the end of ↵Guillaume Gomez-0/+4
`search.js`
2025-06-14Auto merge of #142335 - nnethercote:rustdoc-json-allocations, r=aDotInTheVoidbors-2/+2
rustdoc_json: reduce allocations These commits reduce the number of allocations done for rustdoc_json, mostly by avoiding unnecessary clones. Best reviewed one commit at a time. r? `@aDotInTheVoid`
2025-06-14Fix random failure when JS code is executed when the whole file was not read yetGuillaume Gomez-37/+37
2025-06-11Avoid more clones in rustdoc JSON output.Nicholas Nethercote-1/+1
By making `JsonRenderer::item` take `&clean::Item` instead of a `clean::Item`. This required also changing `FromClean` and `IntoJson` methods to take references, which required a lot of follow-on sigil wrangling that is mostly tedious.
2025-06-10Give more information into extracted doctest informationGuillaume Gomez-1/+2
2025-06-10Simplify `JsonRenderer`.Nicholas Nethercote-1/+1
- It doesn't need to be cloneable. - Some of the `Rc`s and `RefCell`s aren't doing anything. - `after_krate` can consume `self`.
2025-06-07Rollup merge of #140560 - Urgau:test_attr-module-level, r=GuillaumeGomezGuillaume Gomez-1/+0
Allow `#![doc(test(attr(..)))]` everywhere This PR adds the ability to specify [`#![doc(test(attr(..)))]`](https://doc.rust-lang.org/nightly/rustdoc/write-documentation/the-doc-attribute.html#testattr) ~~at module level~~ everywhere in addition to allowing it at crate-root. This is motivated by a recent PR #140323 (by ````@tgross35)```` where we have to duplicate 2 attributes to every single `f16` and `f128` doctests, by allowing `#![doc(test(attr(..)))]` at module level (and everywhere else) we can omit them entirely and just have (in both module): ```rust #![doc(test(attr(feature(cfg_target_has_reliable_f16_f128))))] #![doc(test(attr(expect(internal_features))))] ``` Those new attributes are appended to the one found at crate-root or at a previous module. Those "global" attributes are compatible with merged doctests (they already were before). Given the small addition that this is, I'm proposing to insta-stabilize it, but I can feature-gate it if preferred. Best reviewed commit by commit. r? ````@GuillaumeGomez````
2025-06-05Support middle::ty assoc const eq predicates againLeón Orell Valerian Liehr-19/+22
2025-06-05Rename `should_show_cast` to `should_fully_qualify`León Orell Valerian Liehr-3/+3
2025-05-30Auto merge of #141573 - nnethercote:rustdoc-alloc-cleanups, r=camelidbors-132/+132
rustdoc: cleanups relating to allocations These commits generally clean up the code a bit and also reduce allocation rates a bit. r? `@camelid`
2025-05-30Address review comments.Nicholas Nethercote-6/+6
2025-05-27Rollup merge of #141517 - ↵Trevor Gross-21/+30
lolbinarycat:rustdoc-doctest-tooltip-ignore-141092, r=notriddle rustdoc: use descriptive tooltip if doctest is conditionally ignored fixes https://github.com/rust-lang/rust/issues/141092 here's what it looks like now: ![screenshot](https://github.com/user-attachments/assets/71e679fe-8828-439d-a2ce-b9187ad3aeea)
2025-05-27Streamline `visibility_print_with_space`.Nicholas Nethercote-41/+37
Moving the visibility stuff into the `from_fn` avoids the `Cow` and makes the code a little shorter and simpler.
2025-05-27Streamline `TypeAliasPart::get`.Nicholas Nethercote-17/+16
- `ret` only ever gets at most one entry, so it can be an `Option` instead of a `Vec`. - Which means we can use `filter_map` instead of `flat_map`. - Move `trait_` next to the `ret` assignment, which can only happen once. - No need for `impls` to be a `Vec`, it can remain an iterator. - Avoid `Result` when collecting `impls`.
2025-05-26rustdoc: refactor Tooltip rendering logicbinarycat-43/+21
2025-05-26Avoid some unnecessary cloning.Nicholas Nethercote-11/+10
2025-05-26Make `{Type,Path}::generics` return iterators.Nicholas Nethercote-5/+4
Instead of a `Vec`, to avoid some allocations.
2025-05-26Simplify `make_href`.Nicholas Nethercote-5/+5
It never fails, so it doesn't need to return `Result`. And the `ItemType` in the result is just a copy of the one passed in via the `shortty` arg, so it can also be removed.
2025-05-26Rename some methods.Nicholas Nethercote-25/+36
Most of the methods returning `impl Display` have `print` in their name. This commit renames a few that didn't follow that convention.
2025-05-26Refactor the end of `generate_item_def_id_path`.Nicholas Nethercote-6/+6
To avoids the early return and duplication of `Ok((url_parts, shortty, fqp))`.
2025-05-26Simplify `make_href`.Nicholas Nethercote-3/+4
Currently it is passed an `fqp` slice which it calls `to_vec` on and returns. This is a bit odd. It's better to let the call site clone if necessary. (One call site does, one does not).
2025-05-26Avoid `Box` in `href_relative_parts`.Nicholas Nethercote-25/+20
This reverts part of #91948, going back to returning a `UrlPartsBuilder`. It makes the code simpler, and also avoids some allocations.
2025-05-25Update to new APIGuillaume Gomez-1/+2
2025-05-25Improve codeGuillaume Gomez-44/+44
2025-05-25Tweak attribute rendering depending on wether or not it is a type aliasGuillaume Gomez-18/+104
2025-05-25Rename the `document_*` argument/field into `is_type_alias`Guillaume Gomez-12/+12
2025-05-25Split `Item::attributes` method into threeGuillaume Gomez-2/+2