about summary refs log tree commit diff
path: root/src/librustdoc/html
AgeCommit message (Collapse)AuthorLines
2023-09-01[rustdoc] Fix path in type-based searchGuillaume Gomez-36/+139
2023-08-31Improve `search.js` codeGuillaume Gomez-17/+13
2023-08-28rustdoc: always print type alias inner type (with it's where clauses)Urgau-5/+14
2023-08-27Unify CSS color formats a bit moreGuillaume Gomez-14/+14
2023-08-26Add note about lazy_type_aliasMichael Howell-2/+2
Co-authored-by: León Orell Valerian Liehr <me@fmease.dev>
2023-08-26rustdoc: remove details for type alias inner type and fix sidebarUrgau-94/+77
2023-08-26rustdoc: bind typedef inner type items to the folding systemUrgau-13/+20
This let's us handle a multitude of things for free: - #[doc(hidden)] - private fields/variants - --document-private-items - --document-hidden-items And correct in the process the determination of "has stripped items" by doing the same logic done by other ones.
2023-08-26rustdoc: show inner enum and struct in type definition for concrete typeUrgau-0/+94
2023-08-24rustdoc: list matching impls on type aliasesMichael Howell-4/+43
Remake of "List matching impls on type aliases" * 4b1d13d9841c815915433ca2a3088a8e3e97ad96 * 6f552c800b38b3e71c5e33a295e8b490d2018c71 * 2ce7cd906bde70d8cbd9b07b31c6a7bf1131c345 Partially reverts "Fix infinite loop when retrieving impls for type alias", but keeps the test case. This version of the PR avoids the infinite loop by structurally matching types instead of using full unification. This version does not support type alias trait bounds, but the compiler does not enforce those anyway (https://github.com/rust-lang/rust/issues/21903).
2023-08-24rustdoc: extract logic for printing enum fields and struct variantsUrgau-131/+195
2023-08-24Auto merge of #115078 - camelid:tydef-to-alias, r=aDotInTheVoid,GuillaumeGomezbors-22/+22
rustdoc: Rename typedef to type alias This matches the name used by the [Rust Reference][1], which is also what people usually call these items. [1]: https://doc.rust-lang.org/reference/items/type-aliases.html r? `@GuillaumeGomez`
2023-08-23Rollup merge of #115135 - GuillaumeGomez:no-html-source-flag, r=notriddleGuillaume Gomez-1/+2
Rustdoc: Add unstable --no-html-source flag Fixes https://github.com/rust-lang/rust/issues/115060. This is the equivalent of `#![doc(no_html_source)]` but on the command-line. It disables the generation of the source pages (and of the links pointing to them as well). The motivation behind this is to enable to reduce documentation size when generating it in some locations without enforcing this to end users or adding a new feature to enable/disable the crate attribute. r? `@notriddle`
2023-08-23Add unstable `--no-html-source` rustdoc flagGuillaume Gomez-1/+2
2023-08-21rustdoc-json: Rename typedef to type aliasNoah Lev-5/+5
2023-08-21rustdoc: Rename `clean` items from typedef to type aliasNoah Lev-18/+18
2023-08-21rustdoc: Rename "Type Definition" to "Type Alias"Noah Lev-3/+3
This matches the name used by the Rust Reference [1], which is also what people usually call these items. [1]: https://doc.rust-lang.org/reference/items/type-aliases.html
2023-08-21Auto merge of #106561 - GuillaumeGomez:warning-block, r=rustdocbors-3/+26
Add warning block support in rustdoc Fixes https://github.com/rust-lang/rust/issues/79710. You can test it [here](https://rustdoc.crud.net/imperio/warning-block/foo/struct.Foo.html). It currently looks like this: ![image](https://user-images.githubusercontent.com/3050060/211413494-e1cf04e4-c081-4a9d-97db-27329405cfa7.png) So a few things to note: * Since it's a new add and it's changing the UI, we'll need to go through an FCP. * Does the UI looks good? * Is the way picked to add a warning block ok for everyone? The discussion on the issue seemed to be in favour of this solution but it doesn't hurt to double-check. cc `@rust-lang/rustdoc`
2023-08-18narrow down the lint trigger constraintKyle Lin-9/+26
2023-08-18Fix resolution cachingKyle Lin-0/+1
2023-08-18rework link parsing loopKyle Lin-24/+65
2023-08-16Rollup merge of #114822 - GuillaumeGomez:code-readability-improvement, ↵Matthias Krüger-175/+182
r=notriddle Improve code readability by moving fmt args directly into the string There are some of occurrences where I also transformed `write!(f, "{}", x)` into `f.write_str(x.as_str())`. r? `@notriddle`
2023-08-16Rollup merge of #113115 - tshepang:patch-5, r=est31Matthias Krüger-1/+1
we are migrating to askama see https://github.com/rust-lang/rust/issues/108868
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