Uh oh!
There was an error while loading. Please reload this page.
Add basic splat support to rustdoc - #160882
Conversation
rustbot
commented
Aug 10, 2026
rustbot has assigned @GuillaumeGomez. Use Why was this reviewer chosen?The reviewer was selected based on:
|
bushrat011899
commented
Aug 10, 2026
@rustbot label F-splat |
GuillaumeGomez
commented
Aug 11, 2026
Please add a regression test in |
c649afa to
015e677Comparebushrat011899
commented
Aug 11, 2026
Done! Sorry I should've included that initially, haven't contributed to |
Uh oh!
There was an error while loading. Please reload this page.
notriddle
commented
Aug 11, 2026
rustbot
commented
Aug 11, 2026
Requested reviewer is already assigned to this pull request. Please choose another assignee. |
Simply replace the parameter name and `#[rustc_splat]` attribute with an ellipsis. This preserves the type information of the splat while still documenting the variadic nature of the function.
015e677 to
413fdcaCompareGuillaumeGomez
commented
Aug 11, 2026
Looks good to me, thanks! r=me once CI pass. @bors delegate+ |
✌️ @bushrat011899, you can now approve this pull request! If @GuillaumeGomez told you to " |
bushrat011899
commented
Aug 11, 2026
@bors r=GuillaumeGomez |
Rollup of 14 pull requests Successful merges: - #160620 (Do not pass `-no-pie` on Windows) - #160731 (Arc: Remove unnecessary fmt::Display use for overflow assertion) - #160854 (Add -Zwasm-proc-macros flag) - #160868 (std: Adjust cfgs again for TLS on WASI) - #160882 (Add basic `splat` support to `rustdoc`) - #160894 (Allow running an arbitrary number of try jobs per PR) - #160790 (rustc-book: update sys-v abi link) - #160878 (Add rust_analyzer to check-cfg names) - #160909 (tests/run-make-cargo/thumb-none-cortex-m: bump `cortex-m` dependency) - #160920 (No longer mention the removed generic) - #160921 (rustdoc: Fix invalid CSS classes generated for notable items) - #160924 (split up `rustc_session`) - #160934 (Ensure TLS accesses don't call the global allocator through panic) - #160937 (Store the names of `Fn` trait parameters in the AST, fix rustfmt bug)
Uh oh!
There was an error while loading. Please reload this page.
Rollup merge of #160882 - bushrat011899:rustdoc_splat_ellipsis, r=GuillaumeGomez Add basic `splat` support to `rustdoc` Tracking Issue: #153629 # Description While experimenting on variadic `min`/`max`, it was [noted](rust-lang/libs-team#848 (comment)) that the `rustdoc` output for a splatted function is less than ideal. Consider the below: ```rust pub fn smallest<T: Ord>(#[rustc_splat] vals: impl TupleReduce<Item = T>) -> T { // ... } ``` Currently, this is rendered in `rustdoc` as-is, obfuscating the variadic nature of the function: <img width="819" height="211" alt="image" src="https://github.com/user-attachments/assets/68569fe6-7285-49f8-aae9-ddad0b10649c" /> ## Solution I've updated the clean `Parameter` type to include whether it is splatted, and overridden the display of that parameter to replace the name with an ellipsis, similar to how fake variadic implementations are displayed. <img width="820" height="211" alt="image" src="https://github.com/user-attachments/assets/58a27245-cc38-44e6-908a-f67991bcdb64" /> --- ## Notes * No AI tooling of any kind was used during the creation of this PR.
Rollup of 14 pull requests Successful merges: - rust-lang/rust#160620 (Do not pass `-no-pie` on Windows) - rust-lang/rust#160731 (Arc: Remove unnecessary fmt::Display use for overflow assertion) - rust-lang/rust#160854 (Add -Zwasm-proc-macros flag) - rust-lang/rust#160868 (std: Adjust cfgs again for TLS on WASI) - rust-lang/rust#160882 (Add basic `splat` support to `rustdoc`) - rust-lang/rust#160894 (Allow running an arbitrary number of try jobs per PR) - rust-lang/rust#160790 (rustc-book: update sys-v abi link) - rust-lang/rust#160878 (Add rust_analyzer to check-cfg names) - rust-lang/rust#160909 (tests/run-make-cargo/thumb-none-cortex-m: bump `cortex-m` dependency) - rust-lang/rust#160920 (No longer mention the removed generic) - rust-lang/rust#160921 (rustdoc: Fix invalid CSS classes generated for notable items) - rust-lang/rust#160924 (split up `rustc_session`) - rust-lang/rust#160934 (Ensure TLS accesses don't call the global allocator through panic) - rust-lang/rust#160937 (Store the names of `Fn` trait parameters in the AST, fix rustfmt bug)
Tracking Issue: #153629
Description
While experimenting on variadic
min/max, it was noted that therustdocoutput for a splatted function is less than ideal. Consider the below:Currently, this is rendered in
rustdocas-is, obfuscating the variadic nature of the function:Solution
I've updated the clean
Parametertype to include whether it is splatted, and overridden the display of that parameter to replace the name with an ellipsis, similar to how fake variadic implementations are displayed.Notes