about summary refs log tree commit diff
path: root/src/librustdoc/html
AgeCommit message (Collapse)AuthorLines
2025-05-21rustdoc js: add rustdoc.ScrapedLoc typebinarycat-1/+5
2025-05-21rustdoc js: add ScrapedLoc typebinarycat-4/+16
2025-05-21scrape-examples.js: give each function a signaturebinarycat-9/+24
2025-05-20Get rid of unnecessary `BufDisplay` abstractionYotam Ofek-28/+6
2025-05-20Replace some `unwrap`s with `?`s where possibleYotam Ofek-2/+2
2025-05-20Make some fns return `fmt::Result` to get rid of a few `unwrap`sYotam Ofek-27/+33
2025-05-19Rollup merge of #140874 - mejrs:rads, r=WaffleLapkinStuart Cook-2/+2
make `rustc_attr_parsing` less dominant in the rustc crate graph It has/had a glob re-export of `rustc_attr_data_structures`, which is a crate much lower in the graph, and a lot of crates were using it *just* (or *mostly*) for that re-export, while they can rely on `rustc_attr_data_structures` directly. Previous graph: ![graph_1](https://github.com/user-attachments/assets/f4a5f13c-4222-4903-b56d-28c83511fcbd) Graph with this PR: ![graph_2](https://github.com/user-attachments/assets/1e053d9c-75cc-402b-84df-86229c98277a) The first commit keeps the re-export, and just changes the dependency if possible. The second commit is the "breaking change" which removes the re-export, and "explicitly" adds the `rustc_attr_data_structures` dependency where needed. It also switches over some src/tools/*. The second commit is actually a lot more involved than I expected. Please let me know if it's a better idea to back it out and just keep the first commit.
2025-05-18Remove rustc_attr_data_structures re-export from rustc_attr_parsingmejrs-2/+2
2025-05-17Make some `match`es slightly more ergonomic in `librustdoc`Yotam Ofek-45/+36
2025-05-16rustdoc: on mobile, make the sidebar full width and linewrapbinarycat-1/+4
this is because the mobile sidebar cannot be resized, unlike on desktop.
2025-05-10rustdoc: Fix links in trait impl docsSpecificProtagonist-1/+3
2025-05-09rustdoc: use a different style of grip trackMichael Howell-39/+19
2025-05-09rustdoc: add tooltip to resize trackMichael Howell-1/+1
2025-05-09rustdoc: add a handle that makes sidebar resizing more obviousMichael Howell-7/+53
This change is based on some discussion on [lolbinarycat's idea], but with a more "traditional" design. Specifically, this is the closest thing I could find to a consensus across many systems I looked at for inspiration: - In Jira, resizable sidebars have a stack of four dots. - In The GIMP, resizable sidebars have a stack of three dots. - In [old Windows], "panes" are defined to have the same border style as a window, which has a raised appearance. - In [NeXT], a drag point usually had an innie, whether the line in a slider or the circle in a scroller; I can also hide and show the favorites bar in Workspace by dragging on a circular "grip spot" - In [old Mac], drag handles for things usually had a "grip track" of parallel lines. - [OSX] kept that, but the "Source List" part of the Finder still had the circle grip for a time the same way Workspace did [lolbinarycat's idea]: https://github.com/rust-lang/rust/pull/139420 [old Windows]: https://archive.org/details/windowsinterface00micr/page/n9/mode/2up [old Mac]: https://archive.org/details/apple-hig/1996_Human_Interface_Guidelines_for_Mac_OS_8_%28WWDC_Release%29/page/16/mode/2up [NeXT]: https://archive.org/details/apple-hig/1993%20NeXTSTEP%20User%20Interface%20Guidelines%20-%20Release%203/page/145/mode/2up [OSX]: https://dn721903.ca.archive.org/0/items/apple-hig/MacOSX_HIG_2005_09_08.pdf#page=267
2025-05-06Rollup merge of #140135 - GuillaumeGomez:sidebars-image, r=rustdocGuillaume Gomez-21/+22
Unify sidebar buttons to use the same image Part of https://github.com/rust-lang/rust/issues/139832. The source sidebar looks like this with the new image: ![image](https://github.com/user-attachments/assets/df4fee52-fb71-4794-91b7-3afc6d2aab70) You can test it [here](https://rustdoc.crud.net/imperio/sidebar-images/src/foo/foo.rs.html). r? `@notriddle`
2025-05-05Implement RFC 3503: frontmattersDeadbeef-2/+4
Supercedes #137193
2025-05-02Create a builder for DocTestBuilder typeGuillaume Gomez-4/+6
2025-05-02Emit a warning if the doctest `main` function will not be runGuillaume Gomez-2/+4
2025-04-25Rollup merge of #140248 - GuillaumeGomez:fix-impl-block-items-indent, ↵Matthias Krüger-12/+19
r=notriddle Fix impl block items indent Fixes #139771. Now, all impl block "before impl block items" indent are the same (ie, item info and documentation). With this fix, it looks like this: ![Screenshot From 2025-04-24 12-32-40](https://github.com/user-attachments/assets/907803a2-2949-4d01-afa5-fc3132d10ff2) You can test it [here](https://rustdoc.crud.net/imperio/fix-impl-block-items-indent/foo/struct.Context.html). r? `@notriddle`
2025-04-25Rollup merge of #137096 - ehuss:stabilize-doctest-xcompile, r=fmeaseMatthias Krüger-24/+10
Stabilize flags for doctest cross compilation This makes the following changes in preparation for supporting doctest cross-compiling in cargo: - Renames `--runtool` and `--runtool-arg` to `--test-runtool` and `--test-runtool-arg` to maintain consistency with other `--test-*` arguments. - Stabilizes the `--test-runtool` and `--test-runtool-arg`. These are needed in order to support cargo's `target.runner` option which specifies a runner to execute a cross-compiled doctest (for example, qemu). - Stabilizes the `--enable-per-target-ignores` flag by removing it and making it unconditionally enabled. This makes it possible to disable a doctest on a per-target basis, which I think will be helpful for rolling out this feature. These changes were suggested in https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/stabilizing.20doctest.20xcompile/near/409281127 The intent is to stabilize the doctest-xcompile feature in cargo. This will help ensure that for projects that do cross-compile testing that their doctests are also covered. Currently there is a somewhat surprising behavior that they are ignored. Closes https://github.com/rust-lang/rust/issues/64245 try-job: x86_64-msvc-1
2025-04-24Fix indent of impl docsGuillaume Gomez-1/+4
2025-04-24Make impl item info come before docGuillaume Gomez-11/+15
2025-04-23Unify sidebar buttons to use the same imageGuillaume Gomez-21/+22
2025-04-21Use correct annotation for CSS pseudo elementsGuillaume Gomez-20/+20
2025-04-18Rollup merge of #139913 - fmease:rustdoc-fix-fn-param-handling, r=GuillaumeGomezMatthias Krüger-34/+32
rustdoc/clean: Fix lowering of fn params (fixes correctness & HIR vs. middle parity regressions) **(0)** PR #136411 aimed to stop rendering unnamed params of fn ptr types as underscores in the common case (e.g., `fn(_: i32)` → `fn(i32)`) to make the rendered output stylistically more conventional. **(0.a)** However, since the cleaning fn that the PR modified is also used for lowering the HIR params of foreign fns and required assoc fns in traits, it accidentally butchered the rendering of the latter two: ```rs pub trait Trait { fn assoc_fn(_: i32); } // as well as (Rust 2015 only): fn assoc_fn(i32); unsafe extern "C" { pub fn foreign_fn(_: i32); } // Since 1.86 the fns above gets mis-rendered as: pub fn assoc_fn(: i32) // <-- BUTCHERED pub unsafe extern "C" fn foreign_fn(: i32) // <-- BUTCHERED ``` **(0.b)** Furthermore, it broke parity with middle cleaning (which includes inlined cross-crate re-exports) re-regressing parts of #44306 I once fixed in PR #103885. **(1)** Lastly, PR #139035 introduced an ICE triggered by the following input file: ```rs trait Trait { fn anon(()) {} } // internal error: entered unreachable code ``` --- This PR fixes all of these regressions and in the first commit renames several types and fns to be more ~~correct~~ descriptive and legible. ~~It also refactors `Param.name` to be of type `Option<Symbol>` instead `Symbol` (where `None` ~ `kw::Empty`), so rendering mistakes like that can no longer creep in like that (ignoring tests). CC #137978.~~ Independently done in PR #139846 a day prior.
2025-04-18Rollup merge of #139615 - nnethercote:rm-name_or_empty, r=jdonszelmannMatthias Krüger-6/+6
Remove `name_or_empty` Another step towards #137978. r? ``@jdonszelmann``
2025-04-17Rollup merge of #139943 - fmease:rustdoc-ixcre-trait-aliases, r=GuillaumeGomezMatthias Krüger-2/+3
rustdoc: Support inlined cross-crate re-exported trait aliases Previously we'd just drop them. As a result of this PR, [`core::ptr::Thin`](https://doc.rust-lang.org/nightly/core/ptr/traitalias.Thin.html) will be admitted into the `std` façade! Also, render the where clause *after* the bounds / the `=`, not before them, as it should be. r? rustdoc
2025-04-17rustdoc/clean: Change terminology of items pertaining to (formal) fn params ↵León Orell Valerian Liehr-34/+32
from "argument" to "parameter"
2025-04-17Support inlined cross-crate re-exported trait aliasesLeón Orell Valerian Liehr-2/+3
2025-04-17Replace infallible `name_or_empty` methods with fallible `name` methods.Nicholas Nethercote-6/+6
I'm removing empty identifiers everywhere, because in practice they always mean "no identifier" rather than "empty identifier". (An empty identifier is impossible.) It's better to use `Option` to mean "no identifier" because you then can't forget about the "no identifier" possibility. Some specifics: - When testing an attribute for a single name, the commit uses the `has_name` method. - When testing an attribute for multiple names, the commit uses the new `has_any_name` method. - When using `match` on an attribute, the match arms now have `Some` on them. In the tests, we now avoid printing empty identifiers by not printing the identifier in the `error:` line at all, instead letting the carets point out the problem.
2025-04-17Rollup merge of #139846 - nnethercote:kw-Empty-rustdoc, r=GuillaumeGomezMatthias Krüger-15/+23
Remove `kw::Empty` uses in rustdoc Helps with #137978. r? ``@GuillaumeGomez``
2025-04-15Avoid using `kw::Empty` for param names in rustdoc.Nicholas Nethercote-8/+11
2025-04-15Avoid using `kw::Empty` when comparing names.Nicholas Nethercote-4/+7
2025-04-15Remove another `kw::Empty` use in rustdoc.Nicholas Nethercote-3/+5
Again by using `Option<Symbol>` to represent "no name".
2025-04-10lazify `render_assoc_items_inner`Yotam Ofek-37/+54
2025-04-10make `doc_impl_item` and `render_default_items` receive `impl fmt::Write`Yotam Ofek-126/+108
2025-04-10make `link_tooltip` return `impl fmt::Display`Yotam Ofek-26/+29
2025-04-10make `AllTypes::print` return `impl fmt::Display`Yotam Ofek-40/+36
2025-04-10Rollup merge of #139592 - camelid:doctest-md-opts, r=notriddleMatthias Krüger-1/+1
rustdoc: Enable Markdown extensions when looking for doctests Fixes #139064. We should enable these to avoid misinterpreting uses of the extended syntax as code blocks. This happens in practice with multi-paragraph footnotes, as discovered in #139064.
2025-04-10Rollup merge of #138605 - xizheyin:issue-138567, r=GuillaumeGomezMatthias Krüger-20/+17
Clean up librustdoc::html::render to be better encapsulated Closes #138567
2025-04-09Rollup merge of #139488 - GuillaumeGomez:add-missing-gui-test, r=camelidMatthias Krüger-1/+1
Add missing regression GUI test Add missing GUI test for #139282 (and also fixes the invalid CSS). cc `@lolbinarycat` r? `@notriddle`
2025-04-09rustdoc: Enable Markdown extensions when looking for doctestsNoah Lev-1/+1
We should enable these to avoid misinterpreting uses of the extended syntax as code blocks. This happens in practice with multi-paragraph footnotes, as discovered in #139064.
2025-04-09librustdoc: remove IndexItem::new, use previous fields constructorxizheyin-44/+12
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-04-08Rollup merge of #139321 - GuillaumeGomez:update-rinja, ↵Stuart Cook-21/+21
r=notriddle,lolbinarycat,yotamofek Update to new rinja version (askama) Askama maintenance was handed over to rinja maintainers so new `rinja` release is actually `askama`. More information [here](https://blog.guillaume-gomez.fr/articles/2025-03-19+Askama+and+Rinja+merge). r? ``@notriddle``
2025-04-07Fix CSSGuillaume Gomez-1/+1
2025-04-06Update rinja version in `generate-copyright`Guillaume Gomez-2/+2
2025-04-05Rollup merge of #139274 - lolbinarycat:rustdoc-js-less-expect-error-part5, ↵Stuart Cook-46/+100
r=notriddle Rustdoc: typecheck settings.js This makes the file fully typechecked with no instances of ``````@ts-expect-error`````` and no type casts. r? `````@notriddle`````
2025-04-03Update to new rinja version (askama)Guillaume Gomez-21/+21
2025-04-03Rollup merge of #139282 - lolbinarycat:rustdoc-settings-checkbox-noshrink, ↵Matthias Krüger-0/+3
r=notriddle rustdoc: make settings checkboxes always square Previously, checkboxes would flex horizontally on small screens: ![Screenshot 2025-04-02 at 15-45-13 std - Rust](https://github.com/user-attachments/assets/405dc764-3c04-4ba4-b86c-19e9d4fc0bff) this simple css tweak fixes this.
2025-04-02rustdoc js: satisfy eslintbinarycat-4/+4