about summary refs log tree commit diff
path: root/src/librustdoc
AgeCommit message (Collapse)AuthorLines
2025-02-14librustdoc: create `MaybeDisplay` helper for `Option<T: Display>` typesYotam Ofek-4/+22
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-4/+12
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-4/+12
2025-02-12Nuke `Buffer` abstraction from `librustdoc` 💣Yotam Ofek-648/+710
2025-02-12Rollup merge of #136829 - GuillaumeGomez:move-line-numbers-into-code, ↵Guillaume Gomez-71/+178
r=notriddle [rustdoc] Move line numbers into the `<code>` directly Fixes #84242. This is the first for adding support for https://github.com/rust-lang/rust/issues/127334 and also for another feature I'm working on. A side-effect of this change is that it also fixes source code pages display in lynx since they're not directly in the source code. To allow having code wrapping, the grid approach doesn't work as the line numbers are in their own container, so we need to move them into the code. Now with this, it becomes much simpler to do what we want (with CSS mostly). One downside: the highlighting became more complex and slow as we need to generate some extra HTML tags directly into the highlighting process. However that also allows to not have a huge HTML size increase. You can test the result [here](https://rustdoc.crud.net/imperio/move-line-numbers-into-code/scrape_examples/fn.test_many.html) and [here](https://rustdoc.crud.net/imperio/move-line-numbers-into-code/src/scrape_examples/lib.rs.html#10). The appearance should have close to no changes. r? ``@notriddle``
2025-02-11Remove quotes around href in code line numbersGuillaume Gomez-1/+1
2025-02-11Rollup merge of #135285 - tbu-:pr_fix_typo4, r=GuillaumeGomezMatthias Krüger-1/+1
it-self → itself, build-system → build system, type-alias → type alias
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-09Rollup merge of #136694 - GuillaumeGomez:update-minifier, r=notriddleMatthias Krüger-1/+1
Update minifier version to `0.3.4` It fixes a bug where a whitespace would get removed in `a [attribute]` (you're not forced to add a tag before an attribute selector). r? ````@notriddle````
2025-02-08Rustfmtbjorn3-93/+121
2025-02-07Update minifier version to `0.3.4`Guillaume Gomez-1/+1
2025-02-06Auto merge of #136471 - safinaskar:parallel, r=SparrowLiibors-14/+15
tree-wide: parallel: Fully removed all `Lrc`, replaced with `Arc` tree-wide: parallel: Fully removed all `Lrc`, replaced with `Arc` This is continuation of https://github.com/rust-lang/rust/pull/132282 . I'm pretty sure I did everything right. In particular, I searched all occurrences of `Lrc` in submodules and made sure that they don't need replacement. There are other possibilities, through. We can define `enum Lrc<T> { Rc(Rc<T>), Arc(Arc<T>) }`. Or we can make `Lrc` a union and on every clone we can read from special thread-local variable. Or we can add a generic parameter to `Lrc` and, yes, this parameter will be everywhere across all codebase. So, if you think we should take some alternative approach, then don't merge this PR. But if it is decided to stick with `Arc`, then, please, merge. cc "Parallel Rustc Front-end" ( https://github.com/rust-lang/rust/issues/113349 ) r? SparrowLii `@rustbot` label WG-compiler-parallel
2025-02-06Auto merge of #136265 - notriddle:notriddle/clean-up, r=fmeasebors-17/+15
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-32/+35
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-205/+202
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-205/+202
of implementing it multiple times
2025-02-04Auto merge of #136525 - matthiaskrgr:rollup-m8kqlek, r=matthiaskrgrbors-28/+29
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-28/+29
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-03Rollup merge of #136411 - dtolnay:fnptr, r=notriddleMatthias Krüger-6/+20
Omit argument names from function pointers that do not have argument names This matches the style used for the vast majority of function pointer types in real-world code, in my experience. Prefixing `_: ` to every argument does not improve clarity. **Before:** <img src="https://github.com/user-attachments/assets/f07efa8b-d57e-4897-aa97-40db7d207862"> **After:** <img src="https://github.com/user-attachments/assets/8405e08b-d6d2-4904-bcc3-a3eb866cecf0">
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-03tree-wide: parallel: Fully removed all `Lrc`, replaced with `Arc`Askar Safin-14/+15
2025-02-03Auto merge of #133138 - azhogin:azhogin/target-modifiers, r=davidtwco,saethlinbors-4/+5
Target modifiers (special marked options) are recorded in metainfo Target modifiers (special marked options) are recorded in metainfo and compared to be equal in different linked crates. PR for this RFC: https://github.com/rust-lang/rfcs/pull/3716 Option may be marked as `TARGET_MODIFIER`, example: `regparm: Option<u32> = (None, parse_opt_number, [TRACKED TARGET_MODIFIER]`. If an TARGET_MODIFIER-marked option has non-default value, it will be recorded in crate metainfo as a `Vec<TargetModifier>`: ``` pub struct TargetModifier { pub opt: OptionsTargetModifiers, pub value_name: String, } ``` OptionsTargetModifiers is a macro-generated enum. Option value code (for comparison) is generated using `Debug` trait. Error example: ``` error: mixing `-Zregparm` will cause an ABI mismatch in crate `incompatible_regparm` --> $DIR/incompatible_regparm.rs:10:1 | LL | #![crate_type = "lib"] | ^ | = help: the `-Zregparm` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely = note: `-Zregparm=1` in this crate is incompatible with `-Zregparm=2` in dependency `wrong_regparm` = help: set `-Zregparm=2` in this crate or `-Zregparm=1` in `wrong_regparm` = help: if you are sure this will not cause problems, use `-Cunsafe-allow-abi-mismatch=regparm` to silence this error error: aborting due to 1 previous error ``` `-Cunsafe-allow-abi-mismatch=regparm,reg-struct-return` to disable list of flags.
2025-02-02Rollup merge of #136445 - bjorn3:diag_ctxt_cleanup, r=oli-obkMatthias Krüger-2/+1
Couple of cleanups to DiagCtxt and EarlyDiagCtxt
2025-02-02Rollup merge of #136434 - ↵Matthias Krüger-10/+2
RalfJung:rustc_allowed_through_unstable_modules-deprecation-required, r=compiler-errors rustc_allowed_through_unstable_modules: require deprecation message This changes the `#[rustc_allowed_through_unstable_modules]` attribute so that a deprecation message (ideally directing people towards the stable path) is required.
2025-02-02Some cleanups around EarlyDiagCtxtbjorn3-2/+1
All callers of EarlyDiagCtxt::early_error now emit a fatal error.
2025-02-02Target modifiers (special marked options) are recorded in metainfo and ↵Andrew Zhogin-4/+5
compared to be equal in different crates
2025-02-02rustc_allowed_through_unstable_modules: require deprecation messageRalf Jung-10/+2
2025-02-01Omit argument names from function pointers that do not have argument namesDavid Tolnay-6/+20
2025-02-01Rename `tcx.ensure()` to `tcx.ensure_ok()`Zalathar-2/+2
2025-01-31it-self → itself, build-system → build system, type-alias → type aliasTobias Bucher-1/+1
2025-01-31Rollup merge of #134531 - GuillaumeGomez:extract-doctests, ↵Matthias Krüger-38/+224
r=notriddle,aDotInTheVoid [rustdoc] Add `--extract-doctests` command-line flag Part of https://github.com/rust-lang/rust/issues/134529. It was discussed with the Rust-for-Linux project recently that they needed a way to extract doctests so they can modify them and then run them more easily (look for "a way to extract doctests" [here](https://github.com/Rust-for-Linux/linux/issues/2)). For now, I output most of `ScrapedDoctest` fields in JSON format with `serde_json`. So it outputs the following information: * filename * line * langstr * text cc `@ojeda` r? `@notriddle`
2025-01-30Auto merge of #136318 - matthiaskrgr:rollup-a159mzo, r=matthiaskrgrbors-4/+2
Rollup of 9 pull requests Successful merges: - #135026 (Cast global variables to default address space) - #135475 (uefi: Implement path) - #135852 (Add `AsyncFn*` to `core` prelude) - #136004 (tests: Skip const OOM tests on aarch64-unknown-linux-gnu) - #136157 (override build profile for bootstrap tests) - #136180 (Introduce a wrapper for "typed valtrees" and properly check the type before extracting the value) - #136256 (Add release notes for 1.84.1) - #136271 (Remove minor future footgun in `impl Debug for MaybeUninit`) - #136288 (Improve documentation for file locking) r? `@ghost` `@rustbot` modify labels: rollup
2025-01-30fix(rustdoc): always use a channel when linking to doc.rust-lang.orgAlexis (Poliorcetics) Bourget-28/+29
2025-01-30introduce `ty::Value`Lukas Markeffsky-4/+2
Co-authored-by: FedericoBruzzone <federico.bruzzone.i@gmail.com>
2025-01-30Rollup merge of #133636 - GuillaumeGomez:sans-serif, r=rustdocMatthias Krüger-4/+75
[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-29Collect directly into ThinVecMichael Howell-9/+7
2025-01-29rustdoc: use ThinVec for generic arg partsMichael Howell-8/+8
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-11/+18
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-32/+35
This way, adding a bunch of comments to the JS files won't make rustdoc slower.
2025-01-29Eliminate PatKind::PathOli Scherer-11/+18
2025-01-29Improve check for `--output-format` combinations and add ui regression testGuillaume Gomez-31/+35
2025-01-29Improve code and add missing docs for new `doctest::extracted` moduleGuillaume Gomez-17/+26
2025-01-29Mention the tracking issue of `--output-format=doctest`Guillaume Gomez-0/+2