| Age | Commit message (Collapse) | Author | Lines |
|
Fixes #102576
|
|
All static files used by rustdoc are now stored in static.files/ and
include a hash of their contents. They no longer include the contents of
the --resource-suffix flag. This clarifies caching semantics. Anything
in static.files can use Cache-Control: immutable because any updates
will show up as a new URL.
Invocation-specific files like crates-NN.js, search-index-NN.js,
and sidebar-items-NN.js still get the resource suffix.
The --disable-minification flag is removed because it would vary the
output of static files based on invocation flags. Instead, for
rustdoc development purposes it's preferable to symlink static files
to a non-minified copy for quick iteration.
|
|
This wrapper DIV was originally added in
89e1fb322321c05497caa01372ceb7d5b57fa680, when it allowed the search bar's
size to be calculated without using `calc()`. This `width` hack can be
removed using flexbox.
|
|
|
|
rustdoc: remove class name `location` from sidebar sibling nav
Preview: https://notriddle.com/notriddle-rustdoc-demos/sidebar-location/std/vec/struct.Vec.html
This change tweaks the CSS to apply most of its styles to `.sidebar h2`, cleaning up a few redundant rules from `.mobile-topbar .location` and restoring useful navigation aids in mobile mode.
## Before

## After

|
|
This change tweaks the CSS to apply most of its styles to `.sidebar h2`,
cleaning up a few redundant rules from `.mobile-topbar .location` and
restoring useful navigation aids in mobile mode.
|
|
Since it's possible to have a 700.5px viewport width, the JS needs to not
switch to mobile mode in such a setup.
|
|
https://github.com/rust-lang/rust/pull/98775#issuecomment-1172728308
|
|
|
|
|
|
This allows you to open the help section in a new browser tab, which is a
pretty reasonable thing to want for a documentation page.
|
|
Since 98f05a0282625a5fda6e90ebf3b05a4bd7608f65 removed separate colors
from the currently-selected item, there's no need to have item classes on
sidebar links.
|
|
When this was added, the sidebar had a bit more complex style. It can be
removed, now.
|
|
|
|
Since a7c25b29575c17434406b69773f8c2961af343b3 removed `in-band` from code
headers, the only remaining uses of the `in-band` class are:
https://github.com/rust-lang/rust/blob/02cd79afb8080fce8c8ce35533c54d8ecf8f390e/src/librustdoc/html/render/write_shared.rs#L520-L521
https://github.com/rust-lang/rust/blob/02cd79afb8080fce8c8ce35533c54d8ecf8f390e/src/librustdoc/html/templates/print_item.html#L2-L3
https://github.com/rust-lang/rust/blob/02cd79afb8080fce8c8ce35533c54d8ecf8f390e/src/librustdoc/html/render/context.rs#L637-L638
https://github.com/rust-lang/rust/blob/02cd79afb8080fce8c8ce35533c54d8ecf8f390e/src/librustdoc/html/render/mod.rs#L368-L369
https://github.com/rust-lang/rust/blob/02cd79afb8080fce8c8ce35533c54d8ecf8f390e/src/librustdoc/html/render/mod.rs#L401-L402
https://github.com/rust-lang/rust/blob/02cd79afb8080fce8c8ce35533c54d8ecf8f390e/src/librustdoc/html/static/js/main.js#L525
Since all of these uses are nested below `h1.fqn`, we can get rid of it,
and the support code that was used for when `in-band` was part of item
rendering.
|
|
|
|
* Remove the `float: right` fallback from the main header, which hasn't
been needed since IE11 support was dropped.
* Remove `in-band` from low-level headers, which hasn't been needed since
`.rightside` switched to `float: right` in
593d6d1cb15c55c88319470dabb40126c7b7f1e2
* Remove unreachable `.in-band > code, .in-band > .code-header` CSS, since
the `in-band` class was attached to the `code-header` itself, not nested
directly below it.
* Use `rem` instead of `em` for code header margins.
* This results in a slight change in spacing around impls and item-info,
but since it makes it more consistent with the way methods are presented,
it's probably fine.
|
|
|
|
This commit moves the tooltip into example-wrap, simplifying allowing several
overly-complex things to be fixed:
* The mousover javascript can be removed, because hovering example-wrap can
style the tooltip inside.
* The sibling selecor can be removed, because hovering the tooltip also
hovers the wrapper, which can hover the codeblock itself.
* The relative positioning of the `<li>` tag, which was added in
e861efd9f9ca45c1048a256812dfe8faffbb1367 to fix the positioning of the code
tooltip, can now be removed, because example-wrap itself already has
relative positioning.
|
|
Like #101023, this removes an attribute with a default value.
|
|
Rollup of 14 pull requests
Successful merges:
- #98775 (rustdoc: improve scroll locking in the rustdoc mobile sidebars)
- #99479 (rustdoc-json: Remove doc FIXME for Import::id and explain)
- #100040 (Error on broken pipe but do not backtrace or ICE)
- #100072 (linker-plugin-lto.md: Correct the name of example c file)
- #100098 (Some "this expression has a field"-related fixes)
- #100226 (Do not manually craft a span pointing inside a multibyte character.)
- #100240 (Fail gracefully when const pattern is not structural match.)
- #100256 (Add some high-level docs to `FnCtxt` and `ItemCtxt`)
- #100261 (Set tainted errors bit before emitting coerce suggestions.)
- #100275 (also update anyhow in codegen_cranelift)
- #100281 (Remove more Clean trait implementations)
- #100314 (Mention `unit-test` in MIR opt test README)
- #100319 (Remove more Clean trait implementations)
- #100323 ([rustdoc] Don't render impl blocks with doc comment if they only contain private items by default)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
rustdoc: improve scroll locking in the rustdoc mobile sidebars
This PR prevents the main content area from scrolling while the mobile sidebar is open on documentation pages (porting the scroll locking behavior from the source sidebar to the regular sidebar), and also fixes some bad behavior where opening a "mobile" sidebar, and growing the viewport so that the "desktop" mode without scroll locking is activated, could potentially leave the page stuck.
This does not affect the behavior on larger screens. Only small ones, where the sidebar covers up the main content.
Split out from #98772
|
|
The exact amount that this reduces the size of an implementors file depends
on whether most of the impls are synthetic or not. For `Send`, it reduces
the file from 128K to 116K, while for `Clone` it went from 64K to 52K.
|
|
Rustdoc's current syntax is `-> vec`.
|
|
|
|
This commit ports the scroll locking behavior from the source sidebar to the
regular sidebar, and also fixes some bad behavior where opening a "mobile"
sidebar, and growing the viewport so that the "desktop" mode without scroll
locking is activated, could potentially leave the page stuck.
This does not affect the behavior on larger screens. Only small ones, where
the sidebar covers up the main content.
|
|
Remove unneeded methods declaration for old web browsers
All these methods were not defined for IE mostly. But since we don't support it anymore, no need to keep them around.
cc ```@jsha```
r? ```@notriddle```
|
|
|
|
|
|
This commit fixes the keyboard shorts code to call localStorage every time a
key is pressed. This matters because you're supposed to be able to change a
setting and have it immediately take effect.
|
|
|
|
|
|
|
|
Now that the "All Crates" dropdown is only rendered on the search results page,
there is no need to load crates.js on most pages. Load it only on crate pages.
Also, add the `defer` attribute so it does not block page rendering.
For sidebar-items.js, move the script tag to `<head>`. Since it already has the
defer attribute it won't block loading. The defer attribute does preserve
ordering between scripts, so instead of the callback on load, it can set a
global variable on load, which is slightly simpler. Also, since it is required
to finish rendering the page, beginning its load earlier is better.
Remove generation and handling of sidebar-vars. Everything there can be computed
with information available in JS via other means.
Remove the "other" wrapper in the sidebar. It was unnecessary.
Remove excess script fields
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rustdoc: ensure HTML/JS side implementors don't have dups
Fixes #94641
Rendered:
- https://notriddle.com/notriddle-rustdoc-test/impl-dups/std/iter/trait.Iterator.html
- https://notriddle.com/notriddle-rustdoc-test/impl-dups/core/iter/trait.Iterator.html
|
|
r=jsha
Improve settings loading strategy
I learned about this thanks to ```@jsha``` who suggested this approach:
It improves the settings loading strategy by loading CSS and JS at the same time to prevent the style to be applied afterwards on slow connections.
r? ```@jsha```
|
|
Add rotation animation on settings button when loading
As discussed, I added an animation when the settings JS file is loading (I voluntarily made the timeout at the end of the `settings.js` super long so we can see what the animation looks like):
https://user-images.githubusercontent.com/3050060/166693243-816a08b7-5e39-4142-acd3-686ad9950d8e.mp4
r? ````@jsha````
|
|
|
|
prevent the style to be applied afterwards on slow connections
|
|
|
|
|
|
Fix lint
Fix main.js
Restore anonymous functions
Fix
Fix more
|
|
* Improve code.
* Fix some documentation argument types.
* Make settings order the same as before this PR.
* Change timeout to 0 so that browser will render it as fast as possible.
|