about summary refs log tree commit diff
path: root/src/librustdoc/html/format.rs
AgeCommit message (Collapse)AuthorLines
2024-04-08Thread pattern types through the HIROli Scherer-0/+4
2024-03-14inlineManish Goregaokar-5/+9
2024-03-14print doc(hidden)Manish Goregaokar-5/+14
2024-03-14Refactor visibility_print_with_space to directly take an itemManish Goregaokar-7/+5
2024-02-27Fix link generation for locate foreign macro in jump to definition featureGuillaume Gomez-1/+1
2024-02-24Rustdoc: include crate name in links for local primitivesGurinder Singh-2/+7
It makes the link easier to use in cases in which the path of the page where it will be embedded is not known beforehand such as when we generate impls dynamically from `register_type_impls` method in `main.js` Earlier for local primitives we would generate a path that was relative to the current page depth passed in `cx.current` . e.g if the current page was `std::simd::prelude::Simd` the generated path would be `../../primitive.<prim>.html` After this change the path will first take you to the the wesite root and add the crate name. e.g. for `std::simd::prelude::Simd` the path now will be `../../../std/primitive.<prim>.html`
2024-02-16rustdoc: fix and refactor HTML rendering a bitLeón Orell Valerian Liehr-281/+173
2024-02-09Unify item relative path computation in one functionGuillaume Gomez-24/+2
2024-02-09Correctly generate path for non-local items in source code pagesGuillaume Gomez-52/+140
2023-12-27Introduce `const Trait` (always-const trait bounds)León Orell Valerian Liehr-2/+2
2023-11-30rustdoc: `div.where` instead of fmt-newline classMichael Howell-1/+1
This is about equally readable, a lot more terse, and stops special-casing functions and methods. ```console $ du -hs doc-old/ doc-new/ 671M doc-old/ 670M doc-new/ ```
2023-11-26rustdoc: Remove space from fake-variadic fn ptr implsMaybe Waffle-1/+1
before: `for fn (T₁, T₂, …, Tₙ) -> Ret` after: `for fn(T₁, T₂, …, Tₙ) -> Ret`
2023-11-15Re-format code with new rustfmtMark Rousskov-24/+33
2023-10-21rustdoc: avoid allocating strings primitive link printingMichael Howell-26/+51
This is aimed at hitting the allocator less in a function that gets called a lot.
2023-10-12Hide host effect params from docsOli Scherer-2/+1
2023-10-03rustdoc: fix & clean up handling of cross-crate higher-ranked lifetimesLeón Orell Valerian Liehr-2/+1
2023-09-21Record asyncness span in HIRMichael Goulet-1/+1
2023-08-16Use more named format argsGuillaume Gomez-19/+32
2023-08-16Improve code readability by moving fmt args directly into the stringGuillaume Gomez-30/+25
2023-08-11rustc: Move `features` from `Session` to `GlobalCtxt`Vadim Petrochenkov-1/+1
Removes two pieces of mutable state. Follow up to #114622.
2023-07-27Rollup merge of #114059 - fmease:rustdoc-fix-x-crate-impl-sized, ↵Guillaume Gomez-11/+24
r=GuillaumeGomez rustdoc: fix cross-crate `impl Sized` & `impl ?Sized` Previously, cross-crate impl-Trait (APIT, RPIT, etc.) that only consists of a single `Sized` bound (modulo outlives-bounds) and ones that are `?Sized` were incorrectly rendered. To give you a taste (before vs. after): ```diff - fn sized(x: impl ) -> impl + fn sized(x: impl Sized) -> impl Sized - fn sized_outlives<'a>(x: impl 'a) -> impl 'a + fn sized_outlives<'a>(x: impl Sized + 'a) -> impl Sized + 'a - fn maybe_sized(x: &impl ) -> &impl + fn maybe_sized(x: &impl ?Sized) -> &impl ?Sized - fn debug_maybe_sized(x: &impl Debug) -> &impl ?Sized + Debug + fn debug_maybe_sized(x: &(impl Debug + ?Sized)) -> &(impl Debug + ?Sized) ``` Moreover, we now surround impl-Trait that has multiple bounds with parentheses if they're the pointee of a reference or raw pointer type. This affects both local and cross-crate docs. The current output isn't correct (rustc would emit the error *ambiguous `+` in a type* if we fed the rendered code back to it). --- Best reviewed commit by commit :) `@rustbot` label A-cross-crate-reexports
2023-07-26rustdoc: fix cross-crate impl-SizedLeón Orell Valerian Liehr-11/+24
2023-07-22fix doc links on `extern crate` itemsLukas Markeffsky-1/+9
2023-07-12Re-format let-else per rustfmt updateMark Rousskov-3/+4
2023-06-28rustdoc: Reduce internal function visibility.Alona Enraght-Moony-1/+1
As suggested in https://github.com/rust-lang/rust/pull/112113/files/1862fcb1df05b116443ad3b27028616a180ffadb#r1211200570.
2023-06-24rustdoc: get rid of extra line when line-wrapping fn decls with empty arg listLeón Orell Valerian Liehr-1/+1
2023-06-22Fix indentation for where clause in rustdoc pagesGuillaume Gomez-5/+12
2023-05-30rustdoc: simplify `clean` by removing `FnRetTy`Michael Howell-21/+18
The default fn ret ty is always unit. Just use that. Looking back at the time when `FnRetTy` (then called `FunctionRetTy`) was first added to rustdoc, it seems to originally be there because `-> !` was a special form: the never type didn't exist back then. https://github.com/rust-lang/rust/commit/eb01b17b06eb35542bb80ff7456043b0ed5572ba#diff-384affc1b4190940f114f3fcebbf969e7e18657a71ef9001da6b223a036687d9L921-L924
2023-05-04IAT: Rustdoc integrationLeón Orell Valerian Liehr-11/+35
2023-05-02Make tools happyMichael Goulet-0/+1
2023-04-29fix rustdoc and core testDeadbeef-1/+1
2023-04-10Fix typos in librustdocDaniPopes-2/+2
2023-04-08Auto merge of #109925 - notriddle:notriddle/item-union, r=GuillaumeGomezbors-4/+0
rustdoc: migrate item_union to an Askama template
2023-04-05rustdoc: migrate `item_union` to an Askama templateMichael Howell-4/+0
2023-04-04rustdoc: escape GAT args in more casesLeón Orell Valerian Liehr-16/+15
2023-03-28rustdoc + rustdoc-json support for non_lifetime_bindersMichael Goulet-2/+2
2023-03-20Rollup merge of #109269 - klensy:rdoc-s, r=notriddleMatthias Krüger-1/+1
rustdoc: cleanup some intermediate allocs First commit self contained, second one use `display_fn` for `extra_info_tags`
2023-03-17rustdoc: reduce allocations in `visibility_to_src_with_space`Michael Howell-7/+7
2023-03-16clean up few allocklensy-1/+1
2023-03-15rustdoc: remove `std::` from primitive intra-doc link tooltipsMichael Howell-0/+6
2023-03-11rustdoc: reduce allocs in FnDecl::inner_full_printJacob Hoffman-Andrews-65/+71
Instead of maintaining parallel buffers for both HTML and non-HTML output, follow the idiom from the rest of format.rs that f.alternate() == true means textual output. Also, add an argument to control line wrapping explicitly. This allows the caller to render once with textual output and no line wrapping, to decide whether line wrapping should be applied in the final HTML output. Also, remove some format! and " ".repeat calls, and remove a dependency on calling `String::replace` to switch from newlines to spaces. This coincidentally fixes some minor bugs where the old code was undercounting the number of characters for a declaration in text mode.
2023-03-02rustc_middle: Remove trait `DefIdTree`Vadim Petrochenkov-1/+0
This trait was a way to generalize over both `TyCtxt` and `Resolver`, but now `Resolver` has access to `TyCtxt`, so this trait is no longer necessary.
2023-02-22rustdoc: reduce allocations when generating tooltipsMichael Howell-6/+13
An attempt to reduce the perf regression in https://github.com/rust-lang/rust/pull/108052#issuecomment-1430631861
2023-02-22diagnostics: if AssocFn has self argument, describe as methodMichael Howell-1/+1
Discussed in https://rust-lang.zulipchat.com/#narrow/stream/147480-t-compiler.2Fwg-diagnostics/topic/.22associated.20function.22.20vs.20.22method.22/near/329265515 This commit also changes the tooltips on rustdoc intra-doc links targeting methods.
2023-02-16Rollup merge of #108099 - matthiaskrgr:str_to_char, r=GuillaumeGomezMatthias Krüger-3/+3
use chars instead of strings where applicable
2023-02-15use chars instead of strings where applicableMatthias Krüger-3/+3
2023-02-15Rollup merge of #108076 - GuillaumeGomez:more-let-chain, r=notriddleMatthias Krüger-5/+3
rustdoc: Use more let chain Got the idea after yesterday's review. r? `@notriddle`
2023-02-15Use more let chainGuillaume Gomez-5/+3
2023-02-13rustdoc: add more tooltips to intra-doc linksMichael Howell-0/+16
This commit makes intra-doc link tooltips consistent with generated links in function signatures and item tables, with the format `itemtype foo::bar::baz`. This way, you can tell if a link points at a trait or a type (for example) by mousing over it. See also fce944d4e79b3a87ddf511206724edf33acfd704
2023-02-07rustdoc: use a newline instead of `<br>` to format code headersMichael Howell-17/+14
Since these elements now use `white-space: pre-wrap` since 784665d4ce59c5239791f1f96fa2137e47ca1817, it's fine to use newlines for formatting, which is smaller and a bit less complicated.