summary refs log tree commit diff
path: root/src/librustdoc/html
AgeCommit message (Collapse)AuthorLines
2025-02-14librustdoc: lazily format "read more" link in `document_short`Yotam Ofek-6/+15
2025-02-14librustdoc: lazily format some pathsYotam Ofek-25/+32
2025-02-14librustdoc: lazily format list of aliases in `render_impl_summary`Yotam Ofek-6/+6
2025-02-14librustdoc: make `item_path` formatting lazyYotam Ofek-12/+17
2025-02-14librustdoc: make `notable_traits_button` formatting lazyYotam Ofek-13/+15
2025-02-14librustdoc: make `assoc_href_attr` formatting lazyYotam Ofek-11/+33
2025-02-14librustdoc: make `bounds` formatting lazyYotam Ofek-23/+22
2025-02-14librustdoc: create `MaybeDisplay` helper for `Option<T: Display>` typesYotam Ofek-2/+2
2025-02-13Rollup merge of #136950 - notriddle:notriddle/svg-example-buttons, ↵Jubilee-5/+50
r=GuillaumeGomez rustdoc: use better, consistent SVG icons for scraped examples ## Screenshots ![](https://github.com/user-attachments/assets/f305fb20-5ded-428a-b0d0-04e8b7762769) ![](https://github.com/user-attachments/assets/5b9bee5e-74b9-447b-a19a-49f32b6bf218) ![image](https://github.com/user-attachments/assets/d855a8c8-dc24-44f9-a067-1e0f0654c28a) ![image](https://github.com/user-attachments/assets/71bca54a-0562-480a-8989-938acc351307) ## Description This continues two ongoing projects - Replacing ascii art with real icons that don't look like syntax, are understandable to people who're familiar with desktop computers and smart devices, and aren't ugly. - Using labels and tooltips to clarify these icons, when the limits of popular iconography hit us. In this case, I've added tooltips, because, unfortunately, there's not room for always-visible labels. r? ``@GuillaumeGomez``
2025-02-12Rollup merge of #136927 - GuillaumeGomez:add-missing-hashtag-escape, r=notriddleJacob Pratt-3/+5
Correctly escape hashtags when running `invalid_rust_codeblocks` lint Fixes #136899. We forgot to use `map_line` when we wrote this lint. r? ``@notriddle``
2025-02-12rustdoc: use better, consistent SVG icons for scraped examplesMichael Howell-5/+50
This continues two ongoing projects: - Replacing ascii art with real icons that don't look like syntax, are understandable to people who're familiar with desktop computers and smart devices, and aren't ugly. - Using labels and tooltips to clarify these icons, when the limits of popular iconography hit us. In this case, I've added tooltips, because, unfortunately, there's not room for always-visible labels.
2025-02-12Correctly escape hashtags when running `invalid_rust_codeblocks` lintGuillaume Gomez-3/+5
2025-02-12Nuke `Buffer` abstraction from `librustdoc` 💣Yotam Ofek-648/+709
2025-02-11Remove quotes around href in code line numbersGuillaume Gomez-1/+1
2025-02-11Correctly handle `user-select: none`Guillaume Gomez-0/+5
2025-02-11Update rustdoc testsGuillaume Gomez-5/+5
2025-02-10Move line numbers into the `<code>` directlyGuillaume Gomez-66/+168
2025-02-08Rustfmtbjorn3-29/+38
2025-02-06Auto merge of #136265 - notriddle:notriddle/clean-up, r=fmeasebors-1/+1
rustdoc: use ThinVec for generic arg parts This reduces the size of both these args, and of path segments, so should measurably help with memory use.
2025-02-05Auto merge of #136253 - notriddle:notriddle/aot-minify, r=GuillaumeGomezbors-26/+12
rustdoc: run css and html minifier at build instead of runtime This way, adding a bunch of comments to the JS files won't make rustdoc slower. Meant to address https://github.com/rust-lang/rust/pull/136161#issuecomment-2622069453
2025-02-05Auto merge of #136564 - fmease:rollup-qcjjcm7, r=fmeasebors-148/+156
Rollup of 8 pull requests Successful merges: - #128045 (#[contracts::requires(...)] + #[contracts::ensures(...)]) - #136263 (rustdoc: clean up a bunch of ts-expected-error declarations in main) - #136375 (cg_llvm: Replace some DIBuilder wrappers with LLVM-C API bindings (part 1)) - #136392 (bootstrap: add wrapper macros for `feature = "tracing"`-gated `tracing` macros) - #136396 (rustdoc-json-types: Document that crate name isn't package name.) - #136405 (rustdoc-book: Clean up section on `--output-format`) - #136502 (Mark `std::fmt::from_fn` as `#[must_use]`) - #136509 (Add tests for nested macro_rules edition behavior) r? `@ghost` `@rustbot` modify labels: rollup
2025-02-05Rollup merge of #136263 - notriddle:notriddle/typescript2, r=fmeaseLeón Orell Valerian Liehr-148/+156
rustdoc: clean up a bunch of ts-expected-error declarations in main This mostly consists of handling potentially-null input and adding more global functions to the list of globals. Follow-up for #136161
2025-02-05Auto merge of #136244 - yotamofek:pr/rustdoc-join-iter, r=GuillaumeGomezbors-186/+132
librustdoc: create a helper for separating elements of an iterator instead of implementing it multiple times This implements something similar to [`Itertools::format`](https://docs.rs/itertools/latest/itertools/trait.Itertools.html#method.format), but on `Fn`s returning iterators instead of directly on iterators, to allow implementing `Display` without the use of a `Cell` (to handle the possibility of `fmt` being called multiple times while receiving `&self`). ~This is WIP, I just want to get a perf run first to see if the regression I saw in #135494 is fixed~ This was originally part of #135494 , but originally caused a perf regression that was since fixed: https://github.com/rust-lang/rust/blob/7d5ae1863aa66847a4edf8d2ef9420717df65c5d/src/librustdoc/html/format.rs#L507
2025-02-04librustdoc: create a helper for separating elements of an iterator instead ↵Yotam Ofek-186/+132
of implementing it multiple times
2025-02-04Auto merge of #136525 - matthiaskrgr:rollup-m8kqlek, r=matthiaskrgrbors-20/+21
Rollup of 6 pull requests Successful merges: - #134807 (fix(rustdoc): always use a channel when linking to doc.rust-lang.org) - #134814 (Add `kl` and `widekl` target features, and the feature gate) - #135836 (bootstrap: only build `crt{begin,end}.o` when compiling to MUSL) - #136022 (Port ui/simd tests to use the intrinsic macro) - #136309 (set rustc dylib on manually constructed rustc command) - #136462 (mir_build: Simplify `lower_pattern_range_endpoint`) r? `@ghost` `@rustbot` modify labels: rollup
2025-02-04Rollup merge of #134807 - poliorcetics:ab/push-skpynvsmwkll, r=camelidMatthias Krüger-20/+21
fix(rustdoc): always use a channel when linking to doc.rust-lang.org Closes #131971 I manually checked the resulting links One issue is that this will create `nightly/...` links in places that formerly linked to stable, is that ok ? (the `slice` and `array` links in the search help notably)
2025-02-03rustdoc: clean up a bunch of ts-expected-error declarations in mainMichael Howell-148/+156
This mostly consists of handling potentially-null input and adding more global functions to the list of globals.
2025-02-01Omit argument names from function pointers that do not have argument namesDavid Tolnay-1/+3
2025-01-30fix(rustdoc): always use a channel when linking to doc.rust-lang.orgAlexis (Poliorcetics) Bourget-20/+21
2025-01-30Rollup merge of #133636 - GuillaumeGomez:sans-serif, r=rustdocMatthias Krüger-4/+70
[rustdoc] Add sans-serif font setting Fixes https://github.com/rust-lang/rust/issues/52449. This PR adds a new setting introducing the possibility to switch to a sans-serif font (`Fira Sans`) for the text. Can be tested [here](https://rustdoc.crud.net/imperio/sans-serif/std/index.html). cc ```@rust-lang/rustdoc-frontend``` r? ```@notriddle```
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-29Auto merge of #134248 - oli-obk:patkind-path-removal, r=BoxyUwUbors-10/+16
Merge `PatKind::Path` into `PatKind::Expr` Follow-up to #134228 We always had a duplication where `Path`s could be represented as `PatKind::Path` or `PatKind::Lit(ExprKind::Path)`. We had to handle both everywhere, and still do after #134228, so I'm removing it now.
2025-01-29rustdoc: run css and html minifier at build instead of runtimeMichael Howell-26/+12
This way, adding a bunch of comments to the JS files won't make rustdoc slower.
2025-01-29Eliminate PatKind::PathOli Scherer-10/+16
2025-01-29Add SemiBold for SourceSerif4Guillaume Gomez-3/+12
2025-01-29Add italic for newly added sans serif fontsGuillaume Gomez-3/+21
2025-01-29Add new setting allowing to switch to sans serif fontsGuillaume Gomez-2/+41
2025-01-27rustdoc: add nobuild typescript checking to our JSMichael Howell-680/+1655
By nobuild, I mean that the type annotations are all in comments, not in the "native" typescript syntax. This is a bit uglier, but it lets you rapid-prototype without tsc, works with all the native browser debugging tools, and keeps Node out of Rust's bootstrap chain. This pull request mostly just adds ts-ignore annotations and type declarations. To actually take good advantage of typescript, we'll want to "burn down" this pile of unsafe code until we eventually have a version with almost none of these. This PR also adds tsc to the mingw-check Dockerfile, so that it can't fall out of date like the Closure annotations did. https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/typescript
2025-01-27Add `TooGeneric` variant to `LayoutError` and emit `Unknown` oneFedericoBruzzone-5/+11
- `check-pass` test for a MRE of #135020 - fail test for #135138 - switch to `TooGeneric` for checking CMSE fn signatures - switch to `TooGeneric` for compute `SizeSkeleton` (for transmute) - fix broken tests
2025-01-25Remove extra whitespace from rustdoc breadcrumbs for copypastingKornel-8/+5
2025-01-24Rollup merge of #135998 - GuillaumeGomez:fix-trait-items-mobile-indent, ↵Matthias Krüger-3/+7
r=notriddle [rustdoc] Fix indent of trait items on mobile Before: ![Screenshot From 2025-01-24 15-38-53](https://github.com/user-attachments/assets/f7738ff8-92b6-4aca-8a66-2d3618c54572) After: ![Screenshot From 2025-01-24 15-38-37](https://github.com/user-attachments/assets/0a19dc7e-dddd-4cd5-b087-1915e152d7c1) Seems like we forgot them when we did #131718. Can be tested [here](https://rustdoc.crud.net/imperio/fix-trait-items-mobile-indent/foo/trait.T.html). r? `@notriddle`
2025-01-24Fix indent of trait items on mobileGuillaume Gomez-3/+7
2025-01-23Auto merge of #135494 - yotamofek:rustdoc-fmt-from_fn, r=fmeasebors-100/+81
Refactor `fmt::Display` impls in rustdoc This PR does a couple of things, with the intention of cleaning up and streamlining some of the `fmt::Display` impls in rustdoc: 1. Use the unstable [`fmt::from_fn`](https://github.com/rust-lang/rust/issues/117729) instead of open-coding it. 2. ~~Replace bespoke implementations of `Itertools::format` with the method itself.~~ 4. Some more minor cleanups - DRY, remove unnecessary calls to `Symbol::as_str()`, replace some `format!()` calls with lazier options The changes are mostly cosmetic but some of them might have a slight positive effect on performance.
2025-01-22rustdoc: use std's (unstable) `fmt::from_fn` instead of open-coding itYotam Ofek-91/+72
2025-01-22rustdoc: pass around decoration info by refYotam Ofek-9/+9
2025-01-22rustdoc: Finalize dyn compatibility renamingLeón Orell Valerian Liehr-2/+1
2025-01-19Remove unused `item-row` CSS classGuillaume Gomez-1/+1
2025-01-18Remove more CSS classesGuillaume Gomez-28/+19
2025-01-17Handle reexports items list a bit differently since they cannot have ↵Guillaume Gomez-8/+6
documentation
2025-01-17Replace ul/li list with dl/dd/dt elementsGuillaume Gomez-33/+29