| Age | Commit message (Collapse) | Author | Lines |
|
|
|
As an example, this cuts down
<https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_middle/ty/mod.rs.html>
by about 11%.
$ du -h new_mod.rs.html old_mod.rs.html
296K new_mod.rs.html
332K old_mod.rs.html
|
|
Optimize `Wtf8Buf::into_string` for the case where it contains UTF-8.
Add a `is_known_utf8` flag to `Wtf8Buf`, which tracks whether the
string is known to contain UTF-8. This is efficiently computed in many
common situations, such as when a `Wtf8Buf` is constructed from a `String`
or `&str`, or with `Wtf8Buf::from_wide` which is already doing UTF-16
decoding and already checking for surrogates.
This makes `OsString::into_string` O(1) rather than O(N) on Windows in
common cases.
And, it eliminates the need to scan through the string for surrogates in
`Args::next` and `Vars::next`, because the strings are already being
translated with `Wtf8Buf::from_wide`.
Many things on Windows construct `OsString`s with `Wtf8Buf::from_wide`,
such as `DirEntry::file_name` and `fs::read_link`, so with this patch,
users of those functions can subsequently call `.into_string()` without
paying for an extra scan through the string for surrogates.
r? `@ghost`
|
|
|
|
This fixes the long-standing FIXME there and makes the code easier to
understand. The reference to modules in both the old and new names seems
potentially wrong since I believe it applies to all items.
|
|
This assert is just making sure the size of `Context` doens't grow
unexpectedly, and it's already not being checked on every platform.
`PathBuf` now has a different size on Windows, so adjust this to
avoid checking the size on Windows.
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.
|
|
Particularly when constructing file paths and fully qualified paths.
This avoids a lot of allocations, speeding things up on almost all
examples.
|
|
Migrate rustdoc from Tera to Askama
See #84419.
Should probably get a benchmarking run to verify if it has the intended effect on rustdoc performance.
cc `@jsha` `@jyn514.`
|
|
r=notriddle
Add missing suffix for sidebar-items script path
Fixes https://github.com/rust-lang/docs.rs/issues/1590.
r? ```@syphar```
|
|
|
|
8abb4bb698c9d74507adb9cd7b54a032f3c1b595
|
|
See #84419.
|
|
Change from syntaxy-looking [src] to the plain word "source".
|
|
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.
|
|
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.
|
|
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`
|
|
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
|
|
`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.
|
|
|
|
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`!
|
|
|
|
We carry around a list of stylesheets that can carry two different types
of thing:
1. Internal stylesheets specific to a page type (only for settings)
2. Themes
In this change I move the link generation for settings.css into
settings(), so Context.style_files is reserved just for themes.
We had two places where we extracted a base theme name from a list of
StylePaths. I consolidated that code to be a method on StylePath.
I moved generation of link tags for stylesheets into the page.html
template. With that change, I made the template responsible for special
handling of light.css (making it the default theme) and of the other
themes (marking them disabled). That allowed getting rid of the
`disabled` field on StylePath.
|
|
|
|
rustdoc: Compute some fields of `clean::Crate` on-demand to reduce size
`clean::Crate` is frequently moved by-value -- for example, in `DocFolder`
implementations -- so reducing its size should improve performance.
This PR reduces the size of `clean::Crate` from 168 bytes to 104 bytes.
r? `@jyn514`
|
|
Show all Deref implementations recursively
Fixes #87783.
This is a re-implementation of #80653, so taking the original PR comment:
This changes `rustdoc` to recursively follow `Deref` targets so that methods from all levels are added to the rendered output. This implementation displays the methods from all levels in the expanded state with separate sections for each level.

cc `@camelid`
r? `@jyn514`
|
|
It is not as large as `Crate.src` was, but it's still 8 bytes, and
`clean::Crate` is moved by-value a lot.
|
|
It is only used in one place; `src` was about a third of `Crate`'s total
size; `Crate` is frequently moved by-value; and `src` can be easily
computed on-demand.
|
|
|
|
|
|
|
|
|
|
Scrape code examples from examples/ directory for Rustdoc
Adds support for the functionality described in https://github.com/rust-lang/rfcs/pull/3123
Matching changes to Cargo are here: https://github.com/rust-lang/cargo/pull/9525
Live demo here: https://willcrichton.net/example-analyzer/warp/trait.Filter.html#method.and
|
|
|
|
Add print_item.html and the code in print_item.rs to use it.
|
|
Fix failing test
Add missing backslash
Fix padding issue with horizontal scrollbar
|
|
|