| Age | Commit message (Collapse) | Author | Lines |
|
|
|
This slightly reduces the noisiness of doc pages, making them easier to
read.
|
|
According to MDN
(https://developer.mozilla.org/en-US/docs/Web/CSS/font-size),
> To maximize accessibility, it is generally best to use values that
> are relative to the user's default font size.
> Defining font sizes in px is not accessible, because the user cannot
> change the font size in some browsers.
Note that changing font size (in browser or OS settings) is distinct
from the zoom functionality triggered with Ctrl/Cmd-+. Zoom
functionality increases the size of everything on the page, effectively
applying a multiplier to all pixel sizes. Font size changes apply to
just text.
For relative font sizes, we could use `em`, as we do in several places
already. However that has a problem of "compounding" (see MDN article
for details). The compounding problem is nicely solved by `rem`, which
make font sizes relative to the root element, not the parent element.
Since we were using a hodge-podge of pixel sizes, em, rem, and
percentage sizes before, this change switching everything to rem, while
keeping the same size relative to our old default of 16px.
16px is still the default on most browsers, for users that haven't set a
larger or smaller font size.
|
|
Fix mobile toggles position
Before:

After:

r? `@jsha`
|
|
rustdoc: use smaller number of colors to distinguish items
This reduces visual distractions when reading method signatures.
As discussed in https://github.com/rust-lang/rust/issues/59845#issuecomment-974757191, this categorizes items into one of six colors (down from thirteen):
- method, function (ochre `#AD7C37`)
- trait, trait alias (dark slate blue `#6E4FC9`)
- enum, struct, type alias, union, primitive (maroon `#AD378A`)
- static, module, keyword, associated type, foreign type (steel blue `#3873AD`)
- macro (green `#068000`)
- generic params, self, Self (unmarked black `#000000`)
I slightly tweaked the actual color values so they'd have the same lightness (previously the trait color stood out much more than the others). And I made the color for links in general consistently use steel blue (previously there was a slightly different color for "search-failed").
The ayu and dark themes have been updated according to the same logic. I haven't changed any of the color values in those themes, just their assignment to types.
Demo:
https://rustdoc.crud.net/jsha/fewer-colors/std/string/struct.String.html
https://rustdoc.crud.net/jsha/fewer-colors/std/vec/struct.Vec.html
https://rustdoc.crud.net/jsha/fewer-colors/std/io/trait.Read.html
https://rustdoc.crud.net/jsha/fewer-colors/std/iter/trait.Iterator.html
|
|
Update pulldown-cmark version to 0.9
Fixes https://github.com/rust-lang/rust/issues/92206.
r? `@camelid`
|
|
|
|
remove in_band_lifetimes from librustdoc
r? `@camelid`
closes #92368
|
|
rustdoc: Start cleaning up search index generation
I'm trying to simplify and clean up the code, partly to make #90779 easier.
r? `@GuillaumeGomez`
|
|
rustdoc: Remove `String` allocation in iteration in `print_generic_bounds`
(I realized only after making the commit that maybe I shouldn't refer to iteration as looping, but it's close enough)
The string representation of a `clean::GenericBound` instance (evaluated [here](https://github.com/rust-lang/rust/blob/master/src/librustdoc/html/format.rs#L397)) is deterministic for a given `self` (the instance), `cx` and `f`, and since `cx` and `f` are constant (as far as I can tell) for a given invocation of `print_generic_bounds`, `self` is the determining factor. Therefore, using the data in `self` shouldn't differ in effect from using its string representation.
Given the totality of the function calls needed to evaluate the string representation as well as the actual allocation, at the very least, this shouldn't negatively affect performance.
|
|
|
|
This issue was fixed using a hacky recursion "fuel" argument, but the
issue was never minimized nor was a regression test added. The
underlying bug is still unfixed, so this test should help with fixing it
and removing the `recurse` hack.
|
|
|
|
|
|
|
|
|
|
Now the only two crate-public items are `build_index` and
`get_index_search_type` (because for some reason the latter is also used
in `formats::cache`).
|
|
It was previously defined in `render::search_index` but wasn't used at
all there. `clean::types` seems like a better fit since that's where
`ExternalCrate` is defined.
|
|
Based on
https://github.com/rust-lang/rust/pull/80883#issuecomment-774437832.
The `tcx` parameters do seem to be used though, so I only removed the
`cache` parameters.
|
|
The old name wasn't very clear, while the new one makes it clear that
this is the code responsible for creating the search index.
|
|
|
|
|
|
Move pattern matching outside of the loop
Not sure if worth it but it's been bugging me for a while now.
r? `@camelid`
|
|
Don't emit shared files when scraping examples from dependencies in Rustdoc
This PR fixes #91605. The issue is that `Context::init` gets called when scraping dependencies. By default, just calling `init` calls into `write_shared` and `build_index` which register the scraped crate into a list that later gets used for the Rustdoc sidebar. The fix is to ensure that `write_shared` is not called when scraping.
r? `@jyn514`
|
|
This follows the Closure Compiler dialect of JSDoc, so we
can use it to do some basic type checking. We don't plan to
compile with Closure Compiler, just use it to check types. See
https://github.com/google/closure-compiler/wiki/ for details.
|
|
|
|
|
|
Rollup of 7 pull requests
Successful merges:
- #91141 (Revert "Temporarily rename int_roundings functions to avoid conflicts")
- #91984 (Remove `in_band_lifetimes` from `rustc_middle`)
- #92028 (Sync portable-simd to fix libcore build for AVX-512 enabled targets)
- #92042 (Enable `#[thread_local]` for all windows-msvc targets)
- #92071 (Update example code for Vec::splice to change the length)
- #92077 (rustdoc: Remove unused `collapsed` field)
- #92081 (rustdoc: Remove unnecessary `need_backline` function)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
rustdoc: Remove unused `collapsed` field
`render/context` always runs after `run_global_context`, so it was always set to `true`.
This is a holdover from when rustdoc allowed configuring passes, but the `collapse-docs` pass was
removed ages ago, and the ability to configure passes is about to be removed.
Found while reviewing https://github.com/rust-lang/rust/pull/91305.
|
|
Remove `SymbolStr`
This was originally proposed in https://github.com/rust-lang/rust/pull/74554#discussion_r466203544. As well as removing the icky `SymbolStr` type, it allows the removal of a lot of `&` and `*` occurrences.
Best reviewed one commit at a time.
r? `@oli-obk`
|
|
rustdoc: Add `UrlPartsBuilder`
This is a type for efficiently and easily constructing the part of a URL
after the domain: `nightly/core/str/struct.Bytes.html`.
It allows simplifying some code and avoiding some allocations in the
`href_*` functions.
It will also allow making `Cache.paths` et al. use `Symbol` without
having to allocate `String`s in the `href_*` functions. `String`s would
be necessary otherwise because `Symbol::as_str()` returns `SymbolStr`,
whose `Deref<Target = str>` impl requires the `str` to not outlive it.
This is the primary motivation for the addition of `UrlPartsBuilder`.
|
|
`render/context` always runs after `run_global_context`, so it was always set to `true`.
This is a holdover from when rustdoc allowed configuring passes, but the `collapse-docs` pass was
removed ages ago, and the ability to configure passes is about to be removed.
|
|
Clean up search code and unify function returned values
This PR is a cleanup: there is no changes in the search results or in the UI.
Depending if it was "literal search" or not, it was either returning booleans or integers. It's pretty bad so instead it all returns integers.
Another thing I did was to move the add and checks into a `addIntoResults` function to simplify things.
Last thing: I removed a loop in the `sortResults` function and moved its code directly into the first loop.
All these changes are done to make #90630 much smaller.
r? `@jsha`
|
|
rustdoc: Pretty-print assoc const defaults on-demand
This should improve performance, clean up the code, and help pave the
way for #83035.
|
|
|
|
|
|
Apply rust-logo class only on default logo
Fixes #91653.

Demo: https://rustdoc.crud.net/jsha/hashes/sha2/
r? ``@GuillaumeGomez``
|
|
Also replace ' with " in rustdoc template
|
|
Rollup of 7 pull requests
Successful merges:
- #91880 (fix clippy::single_char_pattern perf findings)
- #91885 (Remove `in_band_lifetimes` from `rustc_codegen_ssa`)
- #91898 (Make `TyS::is_suggestable` check for non-suggestable types structually)
- #91915 (Add another regression test for unnormalized fn args with Self)
- #91916 (Fix a bunch of typos)
- #91918 (Constify `bool::then{,_some}`)
- #91920 (Use `tcx.def_path_hash` in `ExistentialPredicate.stable_cmp`)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
fix clippy::single_char_pattern perf findings
|
|
Fix source code page sidebar on mobile
Current broken behaviour:
https://user-images.githubusercontent.com/3050060/145984316-35c82353-5bab-4dc6-9ac6-63ea7e5c27d8.mp4
Fixed:
https://user-images.githubusercontent.com/3050060/145984329-8be1127b-d707-424d-ac3c-c1fb3c48a093.mp4
r? `@jsha`
|
|
|
|
By changing `as_str()` to take `&self` instead of `self`, we can just
return `&str`. We're still lying about lifetimes, but it's a smaller lie
than before, where `SymbolStr` contained a (fake) `&'static str`!
|
|
|
|
|
|
This is a type for efficiently and easily constructing the part of a URL
after the domain: `nightly/core/str/struct.Bytes.html`.
It allows simplifying some code and avoiding some allocations in the
`href_*` functions.
It will also allow making `Cache.paths` et al. use `Symbol` without
having to allocate `String`s in the `href_*` functions. `String`s would
be necessary otherwise because `Symbol::as_str()` returns `SymbolStr`,
whose `Deref<Target = str>` impl requires the `str` to not outlive it.
This is the primary motivation for the addition of `UrlPartsBuilder`.
|
|
Add `-webkit-appearance: none` to search input
This fixes an issue when displaying on iPad, where the search box had no borders.
r? ``@GuillaumeGomez``
Demo https://rustdoc.crud.net/jsha/webkit-appearance-search-input/std/string/struct.String.html
|
|
This fixes an issue when displaying on iPad, where the search box had no
borders.
|
|
It can always be re-added later if we decide to display associated const
default values.
|
|
This should improve performance, clean up the code, and help pave the
way for #83035.
|