about summary refs log tree commit diff
path: root/src/librustdoc/html
AgeCommit message (Collapse)AuthorLines
2025-08-30rustdoc-search: improve concurrency at type searchMichael Howell-9/+15
2025-08-30rustdoc-search: split function inverted index by input/outputMichael Howell-67/+256
With a patch applied to count the number of unifications, and running the query `Option<T>, (T -> U) -> Option<U>` before: performed unifyFunctionType on 17484 functions after: performed unifyFunctionType on 3055 functions
2025-08-28Create new `Item::is_fake_item` method as equivalent to check for ↵Guillaume Gomez-2/+2
`is_primitive`, `is_keyword` and `is_attribute` methods
2025-08-28Add new `doc(attribute = "...")` attributeGuillaume Gomez-5/+26
2025-08-26Rollup merge of #145596 - lumiscosity:optimize-png-files, r=davidtwcoGuillaume Gomez-0/+0
Losslessly optimize PNG files Losslessly optimizes all of the PNG files in the repo. Done with: ``` oxipng -o max -a -s oxipng -o max --zopfli -a -s ```
2025-08-24Auto merge of #137229 - GuillaumeGomez:expand-macro, r=lolbinarycatbors-61/+472
Add support for macro expansion in rustdoc source code pages This is what it looks like: ![Screenshot From 2025-02-18 18-08-51](https://github.com/user-attachments/assets/ce2b3806-6218-47df-94bf-e9e9ed40cd41) ![image](https://github.com/user-attachments/assets/891042db-8632-4dba-9343-e28570c058fe) You can test it [here](https://rustdoc.crud.net/imperio/macro-expansion/src/lib/lib.rs.html). In this case, I also enabled the `--generate-link-to-definition` to show that both options work well together. Note: <del>There is a bug currently in firefox where the line numbers are not displayed correctly if they're inside the "macro expansion" span: https://bugzilla.mozilla.org/show_bug.cgi?id=1949948<del> Found a workaround around this bug. r? `@notriddle`
2025-08-24rustdoc: render attributes in Field and Variants sectionsKarol Zwolak-4/+22
2025-08-23Rollup merge of #145782 - ↵Samuel Tardieu-70/+68
karolzwolak:rustdoc-consistent-attributes-rendering, r=GuillaumeGomez rustdoc: make attributes render consistently While working on rust-lang/rust#132304, I discovered that even standard attributes aren't consistently rendered. For some constructs/fields, attributes were missing entirely, and the attributes were only sometimes wrapped in a code-attribute divs so they appear greyed out. In short this PR: * makes attributes render inside code elements and inside divs with class `code-attribute` * renders attributes for macros, associated constants, and struct/union fields Attributes in `Fields` and `Variants` sections are still not rendered (see struct and enum screenshots), because I wasn't sure we want that. [Compirison of tests/rustdoc/attributes.rs](https://github.com/karolzwolak/rust/blob/90aa25a1c5dbae1e94099b1a2015dfb83783dbe0/tests/rustdoc/attributes.rs) Before (left) / after (right): <img width="279" height="97" alt="image" src="https://github.com/user-attachments/assets/baca4b75-f809-4a76-8ac1-e3aa6389aad4" /> <img width="363" height="112" alt="image" src="https://github.com/user-attachments/assets/14970fb0-6fe5-474f-983e-5a95e16175c5" /> <img width="368" height="492" alt="image" src="https://github.com/user-attachments/assets/f9a25583-10e3-49c7-961b-34f3587b552e" /> <img width="415" height="515" alt="image" src="https://github.com/user-attachments/assets/f2fe4aa0-c731-4f2f-a3c2-04e524a858d1" /> <img width="383" height="483" alt="image" src="https://github.com/user-attachments/assets/bccc1b6e-f236-4948-8557-f9b25cad8a07" /> <img width="402" height="528" alt="image" src="https://github.com/user-attachments/assets/2cea9250-37e1-439e-8010-0603905d0f52" /> <img width="372" height="485" alt="image" src="https://github.com/user-attachments/assets/cd49bc0a-90e1-4d08-af0f-084c42af1834" /> <img width="406" height="542" alt="image" src="https://github.com/user-attachments/assets/67fb4ac7-746b-4e20-9c80-97702a71def8" /> <img width="357" height="131" alt="image" src="https://github.com/user-attachments/assets/42769532-1e4d-486d-bdca-6ecc409554b9" /> <img width="366" height="161" alt="image" src="https://github.com/user-attachments/assets/0b4d01d4-dd8e-4467-8cfc-ad58200ba0d7" /> <img width="291" height="65" alt="image" src="https://github.com/user-attachments/assets/43f61335-8eff-491b-a297-1953d17bbfc0" /> <img width="259" height="57" alt="image" src="https://github.com/user-attachments/assets/598618a3-e52f-4a4e-b790-2c8d5f1b4c77" /> r? ``@GuillaumeGomez``
2025-08-23Improve code and add test with macro coming from another file from the same ↵Guillaume Gomez-18/+14
crate
2025-08-23rustdoc: make attributes render consistentlyKarol Zwolak-70/+68
* make attributes render inside code elements and inside divs with class `code-attribute` * render attributes for macros, associated constants, and struct/union fields
2025-08-22Rollup merge of #145742 - ↵Jacob Pratt-43/+18
lolbinarycat:rustdoc-search-type-cleanup-continued, r=GuillaumeGomez rustdoc js: Even more typechecking improvments made another pass at eliminating typescript errors, this time mainly focused on adding fields to `window` that weren't declared before. r? `@notriddle`
2025-08-23Also support statements and patterns for macro expansionGuillaume Gomez-2/+18
2025-08-23Improve codeGuillaume Gomez-4/+2
2025-08-23Make macro expansion feature buttons accessibleGuillaume Gomez-10/+11
2025-08-23Do macro expansion at AST level rather than HIRGuillaume Gomez-147/+163
2025-08-23Clean up computation of macro expansion span and correctly handle spans open ↵Guillaume Gomez-28/+90
inside expansion spans
2025-08-23Go around firefox bugGuillaume Gomez-1/+7
2025-08-23Correctly handle multiple macro expansions on a same lineGuillaume Gomez-18/+49
2025-08-23Add new unstable `--generate-macro-expansion` rustdoc command line flagGuillaume Gomez-14/+23
2025-08-23Add support for macro expansion in rustdoc source code pagesGuillaume Gomez-63/+339
2025-08-22main.js: only call window.rustdocToggleSrcSidebar if it existsbinarycat-2/+1
2025-08-22typecheck: add nonnull around element known to existbinarycat-2/+1
2025-08-22typecheck tooltipBlurHandlerbinarycat-1/+3
2025-08-22typecheck window.CURRENT_TOOLTIP_ELEMENTbinarycat-32/+7
2025-08-21typecheck window.NOTABLE_TRAITSbinarycat-2/+2
2025-08-21typecheck window.rr_binarycat-2/+2
2025-08-21typecheck window.searchIndexbinarycat-2/+2
2025-08-21unbox raw pointers in type-based searchbinarycat-3/+6
2025-08-21add special formatting for displaying raw pointers in signaturesbinarycat-2/+22
2025-08-21rustdoc search: accept *mut T syntax for raw pointersbinarycat-30/+45
2025-08-21make primitive:pointer work in type-based search.binarycat-2/+2
2025-08-21Losslessly optimize PNG fileslumiscosity-0/+0
Losslessly optimizes all of the PNG files in the repo. Done with: ``` oxipng -o max -a -s oxipng -o max --zopfli -a -s ```
2025-08-20Fix JS search scripts pathGuillaume Gomez-2/+2
2025-08-20Rollup merge of #140314 - lolbinarycat:rustdoc-js-scrape-examples-typecheck, ↵Jacob Pratt-11/+43
r=notriddle Rustdoc: typecheck scrape-examples.js more typechecking progress, this time we're mostly held back by the fact that `document.querySelectorAll` can't return nice types if its given a compound query (see the issue linked in a code comment). Additionally, it seems like the generated `data-locs` attribute has fields that are never used by anything? r? ```@notriddle```
2025-08-19Rollup merge of #145025 - lolbinarycat:ci-tidy-spellcheck, r=Kobzol许杰友 Jieyou Xu (Joe)-1/+1
run spellcheck as a tidy extra check in ci This is probably how it should've been done from the start. r? ``@Kobzol``
2025-08-16run spellcheck as a tidy extra check in cibinarycat-1/+1
2025-08-15rustdoc-search: search backend with partitioned suffix treeMichael Howell-4247/+8224
2025-08-15Rollup merge of #145389 - GuillaumeGomez:unstable-search, r=fmeaseStuart Cook-39/+2
[rustdoc] Revert "rustdoc search: prefer stable items in search results" Reverts https://github.com/rust-lang/rust/pull/141658 and reverts https://github.com/rust-lang/rust/pull/145349. Reopens https://github.com/rust-lang/rust/issues/138067. r? ```@fmease```
2025-08-14Revert "rustdoc search: prefer stable items in search results"Guillaume Gomez-36/+2
This reverts commit 1140e90074b0cbcfdea8535e4b51877e2838227e.
2025-08-14Revert "rustdoc: IndexItem::{stability -> is_unstable}"Guillaume Gomez-3/+8
This reverts commit 5e8ebd5ecd8546591a6707ac9e1a3b8a64c72f76.
2025-08-14Revert "rustdoc search: add performance note about searchIndexUnstable check"Guillaume Gomez-6/+0
This reverts commit fdbc8d08a63a3d34b7aebabb2f18a768462a98c4.
2025-08-14Revert "Correctly handle when there are no unstable items in the documented ↵Guillaume Gomez-3/+1
crate" This reverts commit cd79c7189db7b611f9199fd12ba56563afa18642.
2025-08-14rustdoc: Allow multiple references to a single footnoteTsukasa OI-9/+24
Multiple references to a single footnote is a part of GitHub Flavored Markdown syntax (although not explicitly documented as well as regular footnotes, it is implemented in GitHub's fork of CommonMark) and not prohibited by rustdoc. cf. <https://github.com/github/cmark-gfm/blob/587a12bb54d95ac37241377e6ddc93ea0e45439b/test/extensions.txt#L762-L780> However, using it makes multiple "sup" elements with the same "id" attribute, which is invalid per the HTML specification. Still, not only this is a valid GitHub Flavored Markdown syntax, this is helpful on certain cases and actually tested (accidentally) in tests/rustdoc/footnote-reference-in-footnote-def.rs. This commit keeps track of the number of references per footnote and gives unique ID to each reference. It also emits *all* back links from a footnote to its references as "↩" (return symbol) plus a numeric list in superscript. As a known limitation, it assumes that all references to a footnote are rendered (this is not always true if a dangling footnote has one or more references but considered a reasonable compromise). Also note that, this commit is designed so that no HTML changes will occur unless multiple references to a single footnote is actually used.
2025-08-13Rollup merge of #145349 - GuillaumeGomez:unstable-items-search, ↵Guillaume Gomez-1/+3
r=lolbinarycat,fmease Correctly handle when there are no unstable items in the documented crate Fixes rust-lang/rust#145287. cc ```@lolbinarycat```
2025-08-13Correctly handle when there are no unstable items in the documented crateGuillaume Gomez-1/+3
2025-08-10rustdoc: Use `discr`s `Display` impl to render the value with the correct ↵Eval EXEC-5/+3
signedness
2025-08-10Ignore impl associated types in jump to def featureGuillaume Gomez-1/+7
2025-08-10Fix panic if an item does not have a bodyGuillaume Gomez-10/+22
2025-08-10Update to last rustc_hir Visitor changesGuillaume Gomez-6/+3
2025-08-10Better handling of paths in link to def featureGuillaume Gomez-73/+117