about summary refs log tree commit diff
path: root/src/librustdoc/html
AgeCommit message (Collapse)AuthorLines
2023-08-16Use more named format argsGuillaume Gomez-57/+88
2023-08-16Improve code readability by moving fmt args directly into the stringGuillaume Gomez-151/+127
2023-08-14Add warning block support in rustdocGuillaume Gomez-3/+26
2023-08-11rustc: Move `features` from `Session` to `GlobalCtxt`Vadim Petrochenkov-1/+1
Removes two pieces of mutable state. Follow up to #114622.
2023-08-04Rollup merge of #114475 - GuillaumeGomez:migrate-gui-test-color-27, r=notriddleMichael Goulet-2/+2
Migrate GUI colors test to original CSS color format Follow-up of https://github.com/rust-lang/rust/pull/111459. r? `@notriddle`
2023-08-04Use similar color scheme to make it obvious they are linkedGuillaume Gomez-2/+2
2023-07-31rustdoc: align stability badge to baseline instead of bottomMichael Howell-0/+1
r? @joshtripplet
2023-07-30Remove some unneeded `clone()` callsGuillaume Gomez-16/+11
2023-07-29Group `write` calls when possible and use new format argsGuillaume Gomez-76/+84
2023-07-29Rollup merge of #113773 - compiler-errors:err-layout-bail, r=cjgillotMatthias Krüger-0/+5
Don't attempt to compute layout of type referencing error Leads to more ICEs and strange diagnostics than are worth it. Fixes #113760
2023-07-28Render generic const items in rustdocLeón Orell Valerian Liehr-22/+32
2023-07-27Fix aksama templateMichael Goulet-0/+5
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-25Auto merge of #113958 - lukas-code:doc-links, r=GuillaumeGomez,petrochenkovbors-1/+9
fix intra-doc links on nested `use` and `extern crate` items This PR fixes two rustdoc ICEs that happen if there are any intra-doc links on nested `use` or `extern crate` items, for example: ```rust /// Re-export [`fmt`] and [`io`]. pub use std::{fmt, io}; // "nested" use = use with braces /// Re-export [`std`]. pub extern crate std; ``` Nested use items were incorrectly considered private and therefore didn't have their intra-doc links resolved. I fixed this by always resolving intra-doc links for nested `use` items that are declared `pub`. <details> During AST->HIR lowering, nested `use` items are desugared like this: ```rust pub use std::{}; // "list stem" pub use std::fmt; pub use std::io; ``` Each of these HIR nodes has it's own effective visibility and the list stem is always considered private. To check the effective visibility of an AST node, the AST node is mapped to a HIR node with `Resolver::local_def_id`, which returns the (private) list stem for nested use items. </details> For `extern crate`, there was a hack in rustdoc that stored the `DefId` of the crate itself in the cleaned item, instead of the `DefId` of the `extern crate` item. This made rustdoc look at the resolved links of the extern crate's crate root instead of the `extern crate` item. I've removed this hack and instead translate the `DefId` in the appropriate places. As as side effect of fixing `extern crate`, i've turned ```rust #[doc(masked)] extern crate self as _; ``` into a no-op instead of hiding all trait impls. Proper verification for `doc(masked)` is included as a bonus. fixes https://github.com/rust-lang/rust/issues/113896
2023-07-22fix doc links on `extern crate` itemsLukas Markeffsky-1/+9
2023-07-22rustdoc: handle cross-crate RPITITs correctlyLeón Orell Valerian Liehr-2/+2
2023-07-20Rollup merge of #113883 - steffahn:rustdoc-search-crate-selector-padding, ↵Matthias Krüger-9/+0
r=GuillaumeGomez Remove outdated Firefox-specific CSS for search's crate selector appearance Remove adjustments that used to be necessary for search's crate selector appearance (padding) to look identical on Firefox. New versions of Firefox appear to have changed behavior to agree with Chrome. As briefly discussed in https://github.com/rust-lang/rust/pull/98855#issuecomment-1624098112 r? ``@GuillaumeGomez``
2023-07-20Rollup merge of #110765 - wackbyte:fix-defaultness-position, ↵Matthias Krüger-4/+4
r=fmease,GuillaumeGomez rustdoc: fix position of `default` in method rendering With the following code: ```rs #![feature(specialization)] pub trait A { unsafe fn a(); } impl A for () { default unsafe fn a() {} } ``` rustdoc would render the `impl` of `a` as ```rs unsafe default fn a() ``` which is inconsistent with the actual position of `default`. This PR fixes this issue.
2023-07-20Remove adjustments that used to be necessary for search's crate selector ↵Frank Steffahn-9/+0
appearance (padding) to look identical on Firefox. New versions of Firefox appear to have changed behavior to agree with Chrome.
2023-07-18Fix display of aliases in rustdoc search resultsGuillaume Gomez-19/+15
2023-07-18Auto merge of #113574 - GuillaumeGomez:rustdoc-json-strip-hidden-impl, ↵bors-1/+1
r=aDotInTheVoid,notriddle Strip impl if not re-exported and is doc(hidden) Part of #112852. r? `@aDotInTheVoid`
2023-07-15Auto merge of #113697 - ↵bors-6/+1
GuillaumeGomez:rm-unneeded-externallocation-handling, r=lqd Remove unneeded handling for `ExternalLocation::Unknown` in rustdoc render context Should fix perf regression introduced in https://github.com/rust-lang/rust/pull/113623. r? `@lqd`
2023-07-14rustdoc: rename to `src-script.js`Michael Howell-0/+0
This is a separate commit to keep Git happy.
2023-07-14rustdoc: use `src` consistently over `source` in JavaScriptMichael Howell-21/+21
Since the directory that contains source files is called `src`, it makes sense to name the scripts that way, too.
2023-07-14rustdoc: use `src` consistently over `source` in codeMichael Howell-55/+55
The CSS uses an inconsistent mix of both. This commit switches it to always use `src`.
2023-07-14Correctly handle `--document-hidden-items`Guillaume Gomez-1/+1
2023-07-14Remove unneeded handling for `ExternalLocation::Unknown` in rustdoc render ↵Guillaume Gomez-6/+1
context
2023-07-14refactor(rustc_middle): Substs -> GenericArgMahdi Dibaiee-1/+1
2023-07-13Rollup merge of #113623 - GuillaumeGomez:add-jump-to-doc, r=notriddleMatthias Krüger-25/+84
Add jump to doc I'm using the source code pages of the compiler quite a lot, but one thing missing is the possibility to jump back from the source code to the item documentation. Since I also got a few others complaining about it, I think it's fine to add it since this option is nightly only. This PR adds a link to jump back to item's documentation on the item definition (so on `Bar` in `struct Bar {... }`, as described in the unofficial [RFC](https://github.com/GuillaumeGomez/rfcs/blob/rustdoc-jump-to-definition/text/000-rustdoc-jump-to-definition.md)). r? ````@notriddle````
2023-07-12Re-format let-else per rustfmt updateMark Rousskov-10/+14
2023-07-12Add jump to docGuillaume Gomez-25/+84
2023-07-03Rollup merge of #113285 - GuillaumeGomez:display-long-inline-cfg, r=notriddleGuillaume Gomez-3/+3
[rustdoc] Fix display of long inline cfg labels Fixes #87957. Fixes #112880. Before: ![Screenshot from 2023-07-03 13-25-47](https://github.com/rust-lang/rust/assets/3050060/401e2c6b-2cfd-4ae3-9d15-b5e1dfec4201) After: ![Screenshot from 2023-07-03 13-24-49](https://github.com/rust-lang/rust/assets/3050060/e42a34a8-bf60-409d-8a0c-1669d09e7e1e) r? `@notriddle`
2023-07-03Fix display of long inline cfg labelsGuillaume Gomez-3/+3
2023-07-02Auto merge of #108537 - ↵bors-73/+174
GuillaumeGomez:rustdoc-search-whitespace-as-separator, r=notriddle rustdoc: Allow whitespace as path separator like double colon Fixes https://github.com/rust-lang/rust/issues/108447. I think it makes sense since it allows more common cases, however it also makes the syntax heavier. Not sure what the rest of the team thinks about it. In any case we'll need to go through FCP. Full explanation for the changes is available [here](https://github.com/rust-lang/rust/pull/108537#issuecomment-1589480564). r? `@notriddle`
2023-07-01Put `LayoutError` behind reference to shrink resultNilstrieb-1/+1
`LayoutError` is 24 bytes, which is bigger than the `Ok` types, so let's shrink that.
2023-06-29Rollup merge of #113119 - aDotInTheVoid:reduce-viz, r=notriddleTakayuki Maeda-1/+1
rustdoc: Reduce internal function visibility. As suggested [here](https://github.com/rust-lang/rust/pull/112113/files/1862fcb1df05b116443ad3b27028616a180ffadb#r1211200570).
2023-06-29Rollup merge of #113100 - GuillaumeGomez:search-result-long-name, r=notriddleTakayuki Maeda-9/+29
Fix display of long items in search results Fixes https://github.com/rust-lang/rust/issues/113060. You can test the result [here](https://rustdoc.crud.net/imperio/search-result-long-name/lib2/index.html). To make it a bit better, I also reduced a bit the size of the short documentation from half to 2 fifth of the width. r? `@notriddle`
2023-06-28accept review suggestionTshepang Mbambo-1/+1
Co-authored-by: Dániel Buga <bugadani@gmail.com>
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-28Fix display of long items in search resultsGuillaume Gomez-9/+29
2023-06-28we are migrating to askamaTshepang Mbambo-1/+1
2023-06-27Replace `id` attribute with `name` for `<meta>` tagGuillaume Gomez-5/+4
2023-06-27Fix invalid HTML DIV tag used in HEADGuillaume Gomez-2/+1
2023-06-25Rollup merge of #113013 - fmease:rustdoc-decl-line-wrapping-slim-arg-list, ↵Matthias Krüger-1/+1
r=camelid rustdoc: get rid of extra line when line-wrapping fn decls with empty arg list Fixes https://github.com/bevyengine/bevy/issues/8898#issuecomment-1605683417: ![Screenshot 2023-06-24 at 23-42-53 any_with_component in bevy_ecs schedule common_conditions - Rust](https://github.com/rust-lang/rust/assets/14913065/4646eba6-b186-4d78-96d9-aad716a4ef5d) It now prints as shown below (which conforms to the style guide): ```rs pub fn any_with_component<T: Component>( ) -> impl FnMut(Query<'_, '_, (), With<T>>) -> bool + Clone ``` The bug was introduced in #109011.
2023-06-25Rollup merge of #112937 - camelid:align-typenames, r=notriddle,GuillaumeGomezMatthias Krüger-2/+4
rustdoc: Align search results horizontally for easy scanning The recent PR #110688 added info about an item's kind before its name in search results. However, because the kind and name are inline with no alignment, it's now hard to visually scan downward through the search results, looking at item names. This PR fixes that by horizontally aligning search results such that there are now two columns of information. r? `@GuillaumeGomez`
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-23rustdoc: fix position of `default` in method renderingwackbyte-4/+4
2023-06-23Reduce typename width to 6.25remNoah Lev-1/+1
This makes "existential type" look slightly cramped (though still readable), but it makes all other typenames look better. Existential types are currently very rare, and we can always tweak this later if necessary.
2023-06-23Rollup merge of #112740 - GuillaumeGomez:link-to-search-chapter, r=notriddleMatthias Krüger-2/+9
Add link to rustdoc book search chapter in help popover One thing that was missing in the rustdoc output and its help popover was a link back to the search feature chapter in the rustdoc book. It looks like this: ![image](https://github.com/rust-lang/rust/assets/3050060/425413e5-e734-4d40-b675-8b2dcef874a2) r? `@notriddle`