| Age | Commit message (Collapse) | Author | Lines |
|
Fix duplicated impl links
Fixes #78701.
The problem is that the blanket impl has the same ID as the other impl, except that we don't derive IDs when we generate the sidebar. We now do.
r? ``@notriddle``
|
|
|
|
|
|
rustdoc: Avoid duplicating macros in sidebar
Fixes #93912.
cc ``````@jsha`````` (for the GUI test)
r? ``````@camelid``````
|
|
Even more let_else adoptions
Continuation of #89933, #91018, #91481, #93046, #93590.
|
|
|
|
elements
|
|
|
|
Refactor sidebar printing code
This is the refactoring parts of #92660, plus the trait aliases capitalization
consistency fix. I think this will be necessary for #92658.
r? `@GuillaumeGomez`
|
|
|
|
The new code is much simpler and easier to understand. In fact, the old
code actually had a subtle bug where it excluded a few item types,
including trait aliases, from the sidebar, even though they are rendered
on the page itself! Now, all sections should show up in the sidebar.
|
|
|
|
|
|
|
|
Emit more valid HTML from rustdoc
Previously, tidy-html5 (`tidy`) would complain about a few things in our HTML. The main thing is that `<summary>` tags can't contain `<div>`s. That's easily fixed by changing out the `<div>`s for `<span>`s with `display: block`.
However, there's also a rule that `<span>`s can't contain heading elements. `<span>` permits only "phrasing content" https://developer.mozilla.org/en-US/docs/Web/HTML/Element/span, and `<h3>` (and friends) are "Flow content, heading content, palpable content". https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Heading_Elements
We have a wrapping `<div>` that goes around each `<h3>`/`<h4>`, etc. We turn that into a `<section>` rather than a `<span>` because `<section>` permits "flow content". https://developer.mozilla.org/en-US/docs/Web/HTML/Element/section
After this change we get only three warnings from tidy, run on struct.String.html:
line 6 column 10790 - Warning: trimming empty <span>
line 1 column 1118 - Warning: <link> proprietary attribute "disabled"
line 1 column 1193 - Warning: <link> proprietary attribute "disabled"
The empty `<span>` is a known issue - there's a span in front of the search box to work around a strange Safari issue.
The `<link>` attributes are the non-default stylesheets. We can probably refactor theme application to avoid using this proprietary "disabled" attribute.
We can suppress those warnings with flags to tidy, and get a run that returns 0 (success):
```
tidy -o /dev/null -quiet --drop-empty-elements no --warn-proprietary-attributes no build/x86_64-unknown-linux-gnu/doc/std/string/trait.ToString.html
```
Note: this requires the latest version of tidy-html5, built from https://github.com/htacg/tidy-html5. Older versions (including the default version on Ubuntu 21.10) think `<section>` can't occur inside `<summary>`.
Demo: https://rustdoc.crud.net/jsha/fix-rustdoc-html/std/string/struct.String.html
r? `@GuillaumeGomez`
|
|
clippy::map_flatten
clippy::clone_on_copy
clippy::useless_conversion
clippy::needless_arbitrary_self_type
|
|
Previously, tidy-html5 (`tidy`) would complain about a few things in our
HTML. The main thing is that `<summary>` tags can't contain `<div>`s.
That's easily fixed by changing out the `<div>`s for `<span>`s with
`display: block`.
However, there's also a rule that `<span>`s can't contain heading
elements. `<span>` permits only "phrasing content"
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/span, and
`<h3>` (and friends) are "Flow content, heading content, palpable
content".
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Heading_Elements
We have a wrapping `<div>` that goes around each `<h3>`/`<h4>`,
etc. We turn that into a `<section>` rather than a `<span>` because
`<section>` permits "flow content".
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/section
After this change we get only three warnings from tidy, run on
struct.String.html:
line 6 column 10790 - Warning: trimming empty <span>
line 1 column 1118 - Warning: <link> proprietary attribute "disabled"
line 1 column 1193 - Warning: <link> proprietary attribute "disabled"
The empty `<span>` is a known issue - there's a span in front of the
search box to work around a strange Safari issue.
The `<link>` attributes are the non-default stylesheets. We can probably
refactor theme application to avoid using this proprietary "disabled"
attribute.
|
|
Improve wrapping on settings page
Previously, the radio button choices for themes would wrap awkwardly on
narrow screens. With this change, the group of choices will prefer
bumping down to the next line together, leaving the setting name on its
own line.
Also fix some minor spacing issues:
- Align the setting name vertically with the radio button choices.
- Use margin instead of padding for most spacing choices.
- Use no margin/padding on the right-hand side.
Demo: https://rustdoc.crud.net/jsha/adjust-settings-layout/settings.html
r? ``@GuillaumeGomez``
Before (narrow screen):

After (narrow screen):

|
|
Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
|
|
Previously, the radio button choices for themes would wrap awkwardly on
narrow screens. With this change, the group of choices will prefer
bumping down to the next line together, leaving the setting name on its
own line.
Also fix some minor spacing issues:
- Align the setting name vertically with the radio button choices.
- Use margin instead of padding for most spacing choices.
- Use no margin/padding on the right-hand side.
|
|
rustdoc: Remove `def_id_no_primitives`
Fixes #90187.
|
|
r=jsha,GuillaumeGomez
rustdoc: remove tooltip from source link
This made more sense back when it was abbreviated, but now it seems redundant.
|
|
This made more sense back when it was abbreviated, but now it
seems redundant.
|
|
|
|
rustdoc settings: use radio buttons for theme
This reduces the number of clicks required to change theme.
Also, simplify the UI a bit (remove setting grouping), and add a "Back" link close to the settings icon.
Demo: https://rustdoc.crud.net/jsha/theme-radio/settings.html
r? ``@GuillaumeGomez``
New:

Old:

|
|
This reduces the number of clicks required to change theme.
Also, simplify the UI a bit (remove setting grouping), and add a "Back"
link close to the settings icon.
|
|
Remove DiagnosticBuilder.quiet
r? `@eddyb`
cc https://github.com/rust-lang/rust/issues/69426 `@GuillaumeGomez` `@Manishearth`
|
|
|
|
They don't need to be `pub`. Making them crate-private improves code
clarity and `dead_code` linting.
|
|
|
|
rustdoc: decouple stability and const-stability
This PR tweaks the stability rendering code to consider stability and const-stability separately. This fixes two issues:
- Stabilities that match the enclosing item are now always omitted, even if the item has const-stability as well (#90552)
- Const-stable unstable functions will now have their (const-) stability rendered.
Fixes #90552.
|
|
This switches to just use size, weight, and spacing to distinguish
headings in the sidebar. We no longer use boxes, horizontal bars, or
centering to distinguish headings. This makes it much easier to
understand the hierarchy of headings, and reduces visual noise.
I also refactored how the mobile topbar works. Previously, we tried to
shift around elements from the sidebar to make the topbar. Now, the
topbar gets its own elements, which can be styled on their own. This
makes styling and reasoning about those elements simpler.
Because the heading font sizes are bigger, increase the sidebar width
slightly.
As a very minor change, removed version from the "All types" page. It's
now only on the crate page.
|
|
Pick themes on settings page, not every page
This hides the paintbrush icon on most pages by default, in preference for the settings on the settings page. When loading from a local file, and not in mobile view, continue to show the theme picker. That's because some browsers limit access to localStorage from file:/// URLs, so choosing a theme from settings.html doesn't take effect.
Fixes #84539
Part of #59840
r? `@GuillaumeGomez`
Demo: https://rustdoc.crud.net/jsha/theme-picker-local-only-2/std/io/trait.Read.html
|
|
Replace `NestedVisitorMap` with generic `NestedFilter`
This is an attempt to make the `intravisit::Visitor` API simpler and "more const" with regard to nested visiting.
With this change, `intravisit::Visitor` does not visit nested things by default, unless you specify `type NestedFilter = nested_filter::OnlyBodies` (or `All`). `nested_visit_map` returns `Self::Map` instead of `NestedVisitorMap<Self::Map>`. It panics by default (unreachable if `type NestedFilter` is omitted).
One somewhat trixty thing here is that `nested_filter::{OnlyBodies, All}` live in `rustc_middle` so that they may have `type Map = map::Map` and so that `impl Visitor`s never need to specify `type Map` - it has a default of `Self::NestedFilter::Map`.
|
|
|
|
|
|
|
|
|
|
rustdoc: Add missing dot separator
Fixes #92901.

r? ``@jsha``
|
|
Link sidebar "location" heading to top of page
This makes it easy, when you are scrolled far down in a page, to jump back to the top.
Demo: https://rustdoc.crud.net/jsha/link-to-top/std/string/struct.String.html
r? ``@GuillaumeGomez``
|
|
|
|
|
|
|
|
librustdoc: Address some clippy lints
|
|
rustdoc: avoid many `Symbol` to `String` conversions.
Particularly when constructing file paths and fully qualified paths.
This avoids a lot of allocations, speeding things up on almost all
examples.
r? `@GuillaumeGomez`
|
|
|
|
|
|
Particularly when constructing file paths and fully qualified paths.
This avoids a lot of allocations, speeding things up on almost all
examples.
|
|
This makes it easy, when you are scrolled far down in a page, to jump
back to the top.
|
|
Use the updated Rust logo in rustdoc
This pull-request use the updated Rust logo from https://github.com/rust-lang/rust-artwork/pull/9 and also change the logo format from PNG to SVG.
| Before | After |
| --- | --- |
|  |  |
I also took the liberty to update the two PNG favicons with the SVG reducing their size by ~35% each.
Fixes https://github.com/rust-lang/rust/issues/92831
r? ```@jsha```
|