| Age | Commit message (Collapse) | Author | Lines |
|
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.
|
|
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
|
|
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`
|
|
`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.
|
|
rustdoc: Pretty-print assoc const defaults on-demand
This should improve performance, clean up the code, and help pave the
way for #83035.
|
|
|
|
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`!
|
|
|
|
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.
|
|
|
|
rustdoc: Show type layout for type aliases
Fixes #91265.
At first, you might think, "Why not just click through to the aliased
type?" But, if a type alias instantiates all of the generic parameters
of the aliased type, then it can show layout info even though the
aliased type cannot (because we can't compute layout for generic types).
So, I think it's useful to show layout info for type aliases.
This is a followup of 78d4b453ad2e19d44011b26fc55c949bff5dba3d
(originally part of #83501).
|
|
|
|
At first, you might think, "Why not just click through to the aliased
type?" But, if a type alias instantiates all of the generic parameters
of the aliased type, then it can show layout info even though the
aliased type cannot (because we can't compute layout for generic types).
So, I think it's useful to show layout info for type aliases.
This is a followup of 78d4b453ad2e19d44011b26fc55c949bff5dba3d
(originally part of #83501).
|
|
Make rustdoc headings black, and markdown blue
Demo:
https://rustdoc.crud.net/jsha/heading-color/std/string/index.html#structs
https://rustdoc.crud.net/jsha/heading-color/std/string/struct.String.html#examples
Fixes #91304
r? ```@camelid``` /cc ```@GuillaumeGomez```
(Note: we may want to make rustdoc headings and markdown headings the same color -- #90245 -- but we would want to do that intentionally; this is fixing up a change that did so accidentally)
|
|
|
|
Rationale:
* The name was confusing.
* It was only used in one place.
* That place didn't actually need all the functionality of `get_type`;
rather, removing `get_type` makes that code clearer.
|
|
Fix const deref methods display
Fixes https://github.com/rust-lang/rust/issues/90855 (more information in the issue).
r? `@camelid`
|
|
|
|
|
|
|
|
|
|
|
|
Checking only their DefId doesn't work because all slices have the same
fake DefId.
Fixes #91347
|
|
rustdoc: Consolidate static-file replacement mechanism
There were a few places in rustdoc where we would take static JS or CSS and rewrite it at doc generation time to insert values. This consolidates all the CSS instances into one CSS file and replaces the JS examples with data- attributes on the rustdoc-vars div.
Demo https://rustdoc.crud.net/jsha/static-file-replace/test_docs/
r? ``@GuillaumeGomez``
|
|
At last! The new name is shorter, simpler, and consistent with
`hir::Ty`.
|
|
I would like to rename it to `Type::Path`, but then it can't be
re-exported since the name would conflict with the `Path` struct.
Usually enum variants are referred to using their qualified names in
Rust (and parts of rustdoc already do that with `clean::Type`), so this
is also more consistent with the language.
|
|
rustdoc: Remove `ResolvedPath.did`
`ResolvedPath.did` was not actually the same as `.path.def_id()`. Instead,
`.did` referred to the `DefId` of the page to be used as a hyperlink target.
For example, a link to `Struct::method()` would use `Struct`'s `DefId` as its
`.did` field. This behavior is confusing, easy to accidentally misuse, and can
instead be obtained on-demand when computing hyperlink targets. It's also likely
part of the reason `kind_side_channel` exists. I'm currently working on some
experimental refactorings in `collect_intra_doc_links` that I believe require --
or at least benefit from -- removing `.did`.
r? `@jyn514`
|
|
|
|
We had been injecting the list of themes and the rustdoc version into
main.js by rewriting it at doc generation time. By avoiding this
rewrite, we can make it easier to edit main.js without regenerating all
the docs.
Added a more convenient accessor for rustdoc-vars.
Changed storage.js to not rely on resourcesSuffix. It could in theory
use rustdoc-vars, but because rustdoc-vars is at the end of the HTML,
it's not available when storage.js runs (very early in page load).
|
|
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.
|
|
Reduce prominence of item-infos
Fixes #59853
- Remove border.
- Reduce size of emoji slightly.
- Remove details disclosure for unstable reason. This was inconsistent with our other details disclosures, and the detail revealed was usually better explained by clicking on the issue link.
Demo: https://rustdoc.crud.net/jsha/chill-item-info/std/mem/union.MaybeUninit.html#method.slice_assume_init_ref
Compare vs: https://doc.rust-lang.org/nightly/std/mem/union.MaybeUninit.html#method.slice_assume_init_ref
<img src="https://user-images.githubusercontent.com/220205/142717815-09828c9e-6ff4-445a-8ccc-31e028fd4985.png" width=700>
|
|
|
|
rustdoc: Make two small cleanups
|
|
- Remove border.
- Reduce size of emoji slightly.
- Remove details disclosure for unstable reason. This was inconsistent
with our other details disclosures, and the detail revealed was
usually better explained by clicking on the issue link.
|
|
|
|
Improve display of enum variants
Use h3 and h4 for the variant name and the "Fields" subheading.
Remove the "of T" part of the "Fields" subheading.
Remove border-bottom from "Fields" subheading.
Move docblock below "Fields" listing.
Fixes #90061
Demo:
https://jacob.hoffman-andrews.com/rust/xmlparser-updated/xmlparser/enum.Token.html#variants
https://jacob.hoffman-andrews.com/rust/fix-enum-variants/std/io/enum.ErrorKind.html#variants
https://jacob.hoffman-andrews.com/rust/fix-enum-variants/std/result/enum.Result.html#variants
r? ``@camelid``
|
|
Remove unneeded FIXMEs comments in search index generation
Original comment:
> Instead of recreating a new `vec` for each arguments, we re-use the same. The impact on performance should be minor but worth a try.
After testing it, we reached the conclusion that the code readability drop wasn't worth the almost unnoticeable performance improvement.
r? `@camelid`
|
|
Rollup of 3 pull requests
Successful merges:
- #90771 (Fix trait object error code)
- #90840 (relate lifetime in `TypeOutlives` bounds on drop impls)
- #90853 (rustdoc: Use an empty Vec instead of Option<Vec>)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
rustdoc: use Type::def_id() instead of Type::def_id_no_primitives()
For: #90187
r? `@jyn514`
|
|
|
|
Add more comments to explain the code to generate the search index
Fixes #90766.
I tried to put comments when the code wasn't easy to understand at first sight and added more documentation on the recursive function. Please tell me if I misused the terminology or if comments can be improved or added into other places.
r? `@notriddle`
|
|
|
|
conclusion that the code readibility wasn't worth the almost unnoticeable perf improvement
|
|
|
|
Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
|