about summary refs log tree commit diff
path: root/src/librustdoc/html
AgeCommit message (Collapse)AuthorLines
2025-03-13Rollup merge of #138109 - Kohei316:feat/rust-doc-precise-capturing-arg, ↵Matthias Krüger-1/+1
r=aDotInTheVoid,compiler-errors make precise capturing args in rustdoc Json typed close #137616 This PR includes below changes. - Add `rustc_hir::PreciseCapturingArgKind` which allows the query system to return a arg's data. - Add `rustdoc::clean::types::PreciseCapturingArg` and change to use it. - Add `rustdoc-json-types::PreciseCapturingArg` and change to use it. - Update `tests/rustdoc-json/impl-trait-precise-capturing.rs`. - Bump `rustdoc_json_types::FORMAT_VERSION`.
2025-03-12Rollup merge of #138318 - lolbinarycat:rustdoc-js-less-expect-error-part2, ↵Manish Goregaokar-37/+52
r=notriddle Rustdoc: remove a bunch of @ts-expect-error from main.js r? ```````@notriddle``````` Most remaining instances of ````````@ts-expect-error```````` in `search.js` and `main.js` are some sort of unchecked assertion, most of them involving nullibility, and we have yet to decide on how to handle these.
2025-03-11Implement `#[define_opaque]` attribute for functions.Oli Scherer-1/+1
2025-03-10main.js: remove searchState from globals.binarycat-1/+1
2025-03-10main.js: typecheck things related to window.register_type_implsbinarycat-8/+10
2025-03-10rustdoc.d.ts: add window.{register_implementors,pending_implementors}binarycat-3/+17
2025-03-10rustdoc.d.ts: window.SIDEBAR_ITEMS may exist.binarycat-1/+2
2025-03-10main.js: handle document.activeElement being nullbinarycat-2/+2
this is technically possible if someone sticks rustdoc in an iframe, i think?
2025-03-10main.js(isDisplayed): coerce truthy values to booleanbinarycat-3/+2
2025-03-10main.js: always refer to searchState through window.searchStatebinarycat-10/+5
2025-03-10main.js: handleEscape and handleShortcut accept KeyboardEventbinarycat-2/+6
2025-03-10main.js: give type signatures to a few helper functionsbinarycat-4/+8
2025-03-10main.js: don't set mouseMovedAfterSearch, as it is never readbinarycat-1/+0
2025-03-10main.js: insertAfter needs non-root referenceNodebinarycat-4/+1
2025-03-10make precise capturing args in rustdoc Json typedmorine0122-1/+1
2025-03-07Rollup merge of #138150 - nnethercote:streamline-intravisit-visit_id, r=oli-obkMatthias Krüger-1/+1
Streamline HIR intravisit `visit_id` calls for items A small clean up.
2025-03-07Rollup merge of #138107 - yotamofek:pr/rustdoc/clippy, r=GuillaumeGomezMatthias Krüger-35/+32
`librustdoc`: clippy fixes First commit is all machine-generated fixes, next two are some more lints fixed by hand/misc. cleanups Inspired by the redundant `.and_then()` added in https://github.com/rust-lang/rust/pull/137320 , and [this comment](https://github.com/rust-lang/rust/pull/138090#discussion_r1983111856) r? ```@GuillaumeGomez```
2025-03-07Move `visit_id` calls.Nicholas Nethercote-1/+1
In `walk_item`, we call `visit_id` on every item kind. For most of them we do it directly in `walk_item`. But for `ItemKind::Mod`, `ItemKind::Enum`, and `ItemKind::Use` we instead do it in the `walk_*` function called (via the `visit_*` function) from `walk_item`. I can see no reason for this inconsistency, so this commit makes those three cases like all the other cases, moving the `visit_id` calls into `walk_item`. This also avoids the need for a few `HirId` arguments.
2025-03-06Manual, post-`clippy --fix` cleanupsYotam Ofek-19/+14
2025-03-06Implement `Ord` by-hand instead of `PartialOrd` for `Link`Yotam Ofek-6/+12
2025-03-06`x clippy src/librustdoc --fix`Yotam Ofek-16/+12
2025-03-06`librustdoc`: flatten nested ifsYotam Ofek-62/+58
2025-03-05Auto merge of #138031 - workingjubilee:rollup-5bsotpz, r=workingjubileebors-45/+41
Rollup of 15 pull requests Successful merges: - #137829 (Stabilize [T]::split_off... methods) - #137850 (Stabilize `box_uninit_write`) - #137912 (Do not recover missing lifetime with random in-scope lifetime) - #137913 (Allow struct field default values to reference struct's generics) - #137923 (Simplify `<Postorder as Iterator>::size_hint`) - #137949 (Update MSVC INSTALL.md instructions to recommend VS 2022 + recent Windows 10/11 SDK) - #137963 (Add ``dyn`` keyword to `E0373` examples) - #137975 (Remove unused `PpMode::needs_hir`) - #137981 (rustdoc search: increase strictness of typechecking) - #137986 (Fix some typos) - #137991 (Add `avr-none` to SUMMARY.md and platform-support.md) - #137993 (Remove obsolete comment from DeduceReadOnly) - #137996 (Revert "compiler/rustc_data_structures/src/sync/worker_local.rs: delete "unsafe impl Sync"") - #138019 (Pretty-print `#[deprecated]` attribute in HIR.) - #138026 (Make CrateItem::body() function return an option) r? `@ghost` `@rustbot` modify labels: rollup
2025-03-04Rollup merge of #137981 - lolbinarycat:rustdoc-js-less-expect-error, r=notriddleJubilee-45/+41
rustdoc search: increase strictness of typechecking r? `@notriddle` The signature of `makePrimitiveElement` is now more accurate. I believe the intent of the code is that `name` cannot be null if `bindingName.name` is null, and I believe typescript is expressive enough to encode this, but I'm not quite sure how, or if this would be desirable. I'm also introducing mapped types into `rustdoc.d.ts`, but I think it's worth it in order to avoid keeping two interfaces in sync. I may add more commits onto this to remove more ``@ts-expect-error`` instances.
2025-03-04search.js: remove incorrect outdated commentbinarycat-2/+0
2025-03-04search.js: give RawSearchIndexCrate.a an index signaturebinarycat-4/+2
2025-03-04search.js: allow empty result arraysbinarycat-4/+3
2025-03-04search.js: give buildIndex a proper return typebinarycat-2/+5
some of the fields of rustdoc.Row were confusing null and undefined.
2025-03-04search.js: give local `where` a typebinarycat-2/+1
2025-03-04give local mgens a typebinarycat-2/+1
2025-03-04search.js: give pathSplitter a type signaturebinarycat-1/+5
2025-03-04search.js: second argument of convertNameToId is optionalbinarycat-2/+1
2025-03-04search.js: local variable `extra` is an array, annotate it as such.binarycat-2/+2
2025-03-04don't use double quotesbinarycat-1/+1
2025-03-04fix whitespacebinarycat-6/+6
2025-03-04Adapt `librustdoc` to 2024 edition lifetieme capture rulesYotam Ofek-415/+265
Get rid of the `Captures` hack
2025-03-04`librustdoc`: 2024 edition! 🎊Yotam Ofek-5/+5
2025-03-04ParserQueryElement.typeFilter MAY be a string, OR number.binarycat-4/+2
ideally we would encode that it is a string before convertTypeFilterOnElem is called, and a number after, but i'm not sure that's possible without significant refactoring.
2025-03-04rustdoc search: give buildTypeMapIndex a conditional return typebinarycat-16/+10
we encode "if the argument is a non-empty string, this will never return null" into the type signature.
2025-03-03rustdoc search: increase strictness of typecheckingbinarycat-6/+11
2025-03-03Rollup merge of #137684 - GuillaumeGomez:rustdoc-dep-info, r=notriddleMatthias Krüger-1/+1
Add rustdoc support for `--emit=dep-info[=path]` Fixes #91982. This PR adds the `--emit=dep-info` command line flag support. It will be helpful for `cargo` development. cc ````@epage```` r? ````@notriddle````
2025-03-02Auto merge of #137425 - yotamofek:pr/rustdoc/return-impl-display-redux, ↵bors-2274/+2476
r=GuillaumeGomez `librustdoc`: return `impl fmt::Display` in more places instead of writing to strings Continuation of #136784 , another attempt at landing the larger parts of #136748 . I'd like to, gradually, make all of the building blocks for rendering docs in `librustdoc` return `impl fmt::Display` instead of returning `Strings`, or receiving a `&mut String` (or `&mut impl fmt::Write`). Another smaller end goal is to be able to get rid of [`write_str`](https://github.com/rust-lang/rust/blob/8dac72bb1d12b2649acd0c190e41524f83da5683/src/librustdoc/html/format.rs#L40-L42). This PR is a large step in that direction. Most of the changes are quite mechanical, and split up into separate commits for easier reviewing (hopefully). I took `print_item` and then started by converting all the functions it called (and their dependencies), and the last commit does the conversion for `print_item` itself. Ignoring whitespace should make reviewing a bit easier. And most importantly, perf run shows pretty good results locally, hopefully CI will also show green 😁 r? `@GuillaumeGomez` , if you feel like it.
2025-02-26Use helper function instead of reimplementing the logic to check if rustdoc ↵Guillaume Gomez-1/+1
should emit crate
2025-02-25Update information about NanumBarunGothicColin Pitrat-1/+11
2025-02-25Complete the list of resources used in rustdoc outputColin Pitrat-0/+11
2025-02-24Auto merge of #137511 - jhpratt:rollup-07whsax, r=jhprattbors-61/+99
Rollup of 10 pull requests Successful merges: - #136610 (Allow `IndexSlice` to be indexed by ranges.) - #136991 ([rustdoc] Add new setting to wrap source code lines when too long) - #137061 (Unstable `gen_future` Feature Tracking ) - #137393 (Stabilize `unbounded_shifts`) - #137482 (Windows: use existing wrappers in `File::open_native`) - #137484 (Fix documentation for unstable sort on slice) - #137491 (Tighten `str-to-string-128690.rs``CHECK{,-NOT}`s to make it less likely to incorrectly fail with symbol name mangling) - #137495 (Added into_value function to ControlFlow<T, T>) - #137501 (Move `impl` blocks out of `rustc_middle/src/mir/syntax.rs`) - #137505 (Add a span to `CompilerBuiltinsCannotCall`) r? `@ghost` `@rustbot` modify labels: rollup
2025-02-24Rollup merge of #136991 - GuillaumeGomez:code-wrapping, r=notriddleJacob Pratt-61/+99
[rustdoc] Add new setting to wrap source code lines when too long Fixes https://github.com/rust-lang/rust/issues/127334. Wrapped lines look like this: ![image](https://github.com/user-attachments/assets/92006a27-ed1e-4beb-91f2-f453b72c5e1a) It works in both source code pages and doc pages. You can test it [here](https://rustdoc.crud.net/imperio/code-wrapping/bar/index.html). r? ``@notriddle``
2025-02-24Auto merge of #137285 - yotamofek:pr/rustdoc/pulldown-escaping, r=GuillaumeGomezbors-48/+3
librustdoc: Use `pulldown-cmark-escape` for HTML escaping Implementation of `@notriddle` 's [suggestion](https://github.com/rust-lang/rust/pull/137274#issuecomment-2669001585). Somewhat related to #137274 , but the two PRs should be complementary. Local perf results look like a nice improvement! (so would love a perf run on the CI)
2025-02-23return `impl fmt::Display` in more places instead of writing to stringsYotam Ofek-2274/+2476
2025-02-22Rename feature into `Word wrap source code`Guillaume Gomez-20/+20