about summary refs log tree commit diff
path: root/src/librustdoc/html
AgeCommit message (Collapse)AuthorLines
2025-02-22Make asm a named fieldMichael Goulet-1/+1
2025-02-20Rollup merge of #137106 - chenyukang:yukang-fix-sidebar-sort, r=notriddleMatthias Krüger-1/+17
Add customized compare for Link in rustdoc Maybe some other types in sidebar need to be sorted in this way, maybe add this crate `natord` is ok? r? clubby789 Fixes #137098
2025-02-19librustdoc: Use `pulldown-cmark-escape` for HTML escapingYotam Ofek-48/+3
2025-02-19Add custom sort for link in rustdocyukang-1/+17
2025-02-18Rollup merge of #136599 - yotamofek:pr/rustdoc-more-joined, r=GuillaumeGomezMatthias Krüger-16/+12
librustdoc: more usages of `Joined::joined` Some missed opportunities from #136244 r? ```@GuillaumeGomez``` since you reviewed the last one (feel free to re-assign, of course 😊) First two commits are just drive-by cleanups
2025-02-18Move methods from `Map` to `TyCtxt`, part 2.Nicholas Nethercote-5/+5
Continuing the work started in #136466. Every method gains a `hir_` prefix, though for the ones that already have a `par_` or `try_par_` prefix I added the `hir_` after that.
2025-02-17librustdoc: more usages of `Joined::joined`Yotam Ofek-16/+12
2025-02-17Overhaul the `intravisit::Map` trait.Nicholas Nethercote-2/+2
First of all, note that `Map` has three different relevant meanings. - The `intravisit::Map` trait. - The `map::Map` struct. - The `NestedFilter::Map` associated type. The `intravisit::Map` trait is impl'd twice. - For `!`, where the methods are all unreachable. - For `map::Map`, which gets HIR stuff from the `TyCtxt`. As part of getting rid of `map::Map`, this commit changes `impl intravisit::Map for map::Map` to `impl intravisit::Map for TyCtxt`. It's fairly straightforward except various things are renamed, because the existing names would no longer have made sense. - `trait intravisit::Map` becomes `trait intravisit::HirTyCtxt`, so named because it gets some HIR stuff from a `TyCtxt`. - `NestedFilter::Map` assoc type becomes `NestedFilter::MaybeTyCtxt`, because it's always `!` or `TyCtxt`. - `Visitor::nested_visit_map` becomes `Visitor::maybe_tcx`. I deliberately made the new trait and associated type names different to avoid the old `type Map: Map` situation, which I found confusing. We now have `type MaybeTyCtxt: HirTyCtxt`.
2025-02-16Auto merge of #136363 - notriddle:notriddle/unresolved-link-unused-refdef, ↵bors-3/+67
r=GuillaumeGomez rustdoc: improve refdef handling in the unresolved link lint This commit takes advantage of a feature in pulldown-cmark that makes the list of link definitions available to the consuming application. It produces unresolved link warnings for refdefs that aren't used, and can now produce exact spans for the dest even when it has escapes. Closes #133150 since this lint would have caught the mistake in that issue, and, along with https://github.com/rust-lang/rust-clippy/pull/13707, most mistakes in this class should produce a warning from one of them.
2025-02-15rustdoc: improve refdef handling in the unresolved link lintMichael Howell-3/+67
This commit takes advantage of a feature in pulldown-cmark that makes the list of link definitions available to the consuming application. It produces unresolved link warnings for refdefs that aren't used, and can now produce exact spans for the dest even when it has escapes.
2025-02-15Rollup merge of #137068 - tapanprakasht:fix-copy-item-path, r=aDotInTheVoidMatthias Krüger-1/+4
fix(rustdoc): Fixed `Copy Item Path` in rust doc This PR aims to address the issue reported by https://github.com/rust-lang/rust/issues/137048 Issue caused by previous changes for removing `@ts-expect-error` by this change https://github.com/rust-lang/rust/commit/2ea95f867012e91fa742e60b7b6424abf86c05cf
2025-02-15Rollup merge of #137055 - fmease:rustdoc-js-fix-input-placeholder-logic, ↵Matthias Krüger-2/+3
r=notriddle rustdoc: Properly restore search input placeholder Fix the search input placeholder literally getting set to the string *undefined* on blur/defocus. This was caused by us trying to access an undefined property in the event listener. To prevent this from regressing again, stop typescript from ignoring the relevant site. Steps to reproduce the bug fixed in this PR: 1. Focus the search input field by clicking on it and clear the input if necessary 2. Blur/defocus it by clicking somewhere outside of it --- First bug that would've been caught by TSC if we had had it earlier! Type (quasi-)safety, ahoy! :)
2025-02-15fix(rustdoc): Fixed `Copy Item Path` in rust docTapan Prakash-1/+4
2025-02-15rustdoc: Properly restore search input placeholderLeón Orell Valerian Liehr-2/+3
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-14Add new setting to wrap source code lines when too longGuillaume Gomez-61/+99
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