about summary refs log tree commit diff
path: root/src/librustdoc/html/render
AgeCommit message (Collapse)AuthorLines
2021-06-10manually crafted revert of PR #80653, to address issue #82465.Felix S. Klock II-27/+8
(update: placated tidy) (update: rebased post PR #84707 ) merge me
2021-06-07Refactor: Extract render_summary from render_impl.Jacob Hoffman-Andrews-78/+86
This allows for a more readable straight-through logic in render_impl without need for a closure.
2021-06-05Fix invalid ID value in all.html fileGuillaume Gomez-2/+8
2021-06-05Rollup merge of #85503 - liigo:tooltips, r=GuillaumeGomezGuillaume Gomez-1/+1
rustdoc: add tooltips to some buttons
2021-06-03Auto merge of #84834 - GuillaumeGomez:sidebar-unification, r=jshabors-40/+39
Sidebar unification This PR does a few things: * Put crates list at all levels (before, it was only on the "top" items) * Fix bug in module sidebar: the list of items was from the parent module. The other changes (on bootstrap mostly) were to allow to generate multiple crates in a same folder so that we can ensure that clicking on the crates in the sidebar works as expected. I added a rustdoc-gui test to ensure everything is where it should be. r? `@jyn514`
2021-06-02Remove data-level selectors from CSS.Jacob Hoffman-Andrews-11/+7
2021-06-01Don't generate impl-items div container if there is noneGuillaume Gomez-4/+6
2021-06-01Remove invalid usage of aria-levelGuillaume Gomez-7/+7
2021-06-01Replace h3 and h4 containing invalid DOMGuillaume Gomez-14/+32
2021-06-01Replace empty href with "#"Guillaume Gomez-1/+1
2021-06-01Rollup merge of #85622 - jsha:untoggle-undocumented, r=GuillaumeGomezGuillaume Gomez-10/+4
Remove toggle for "undocumented items." Per discussion in #84326. For trait implementations, this was misleading: the items actually do have documentation (but it comes from the trait definition). For both trait implementations and trait implementors, this was redundant: in both of those cases, the items are default-hidden by different toggle at the level above. Update tests: Remove XPath selectors that over-specified on details tag, in cases that weren't testing toggles. Add an explicit test for toggles on methods. Rename item-hide-threshold to toggle-item-contents for consistency. Demo: https://hoffman-andrews.com/rust/untoggle-undocumented/std/string/struct.String.html https://hoffman-andrews.com/rust/untoggle-undocumented/std/io/trait.Read.html
2021-05-31Add title for copy to clipboard button in rustdocIvan Tham-1/+2
2021-05-31Improve display of the separation between page items and siblings in the sidebarGuillaume Gomez-1/+1
2021-05-31Only list crates on the crate pageGuillaume Gomez-1/+8
2021-05-31Remove unneeded file to load sidebar items at crate levelGuillaume Gomez-1/+0
2021-05-31* Put crates list at all levelsGuillaume Gomez-38/+31
* Fix bug in module sidebar: the list of items was from the parent module
2021-05-30Remove toggle for "undocumented items."Jacob Hoffman-Andrews-10/+4
Per discussion in #84326. For trait implementations, this was misleading: the items actually do have documentation (but it comes from the trait definition). For both trait implementations and trait implementors, this was redundant: in both of those cases, the items are default-hidden by different toggle at the level above. Update tests: Remove XPath selectors that over-specified on details tag, in cases that weren't testing toggles. Add an explicit test for toggles on methods. Rename item-hide-threshold to toggle-item-contents for consistency.
2021-05-28Remove `--print unversioned-files` from rustdocBoris-Chengbiao Zhou-2/+1
This flag isn't needed anymore. See #83784.
2021-05-27Rollup merge of #85722 - GuillaumeGomez:trait-toggle, r=jshaGuillaume Gomez-4/+13
Fix trait methods' toggle A `<details>` tag wasn't closed on trait methods, which created broken DOM. I also used this occasion to only generate the toggle in case there is documentation on the method. r? `@jsha`
2021-05-26* Fix bug where some <details> tags were not closed.Guillaume Gomez-4/+13
* Don't generate a <details> if there is no documentation
2021-05-26Rollup merge of #84048 - konan8205:master, r=jshaYuki Okushi-0/+2
Avoid CJK legacy fonts in Windows As metioned in #84035, the default serif CJK font in Windows is meh-looking. To avoid this, we should use sans-serif font or provide CJK glyph supported font in `rustdoc.css`.
2021-05-24Remove doubled braces in non_exhaustive structs’ documentation text.Kevin Reid-1/+1
In commit 4b806878549990d2ad2aa3c265751d3d89947cdf (part of Rust 1.52.1) many calls to `write!(w,` were replaced with `w.write_str(`, but this one contained braces that were doubled to escape them when taken as a format string, and so changing the call without changing the text caused them to become doubled in the final HTML output. I examined `print_item.rs` and the diff of that prior commit for any other occurrences of this mistake and I did not find any.
2021-05-23Don't hide inherent implementations by defaultGuillaume Gomez-5/+14
2021-05-22Fix auto-hide for implementations and implementors.Jacob Hoffman-Andrews-1/+1
This sets their toggles to be closed in the HTML (matching the default setting), and opens them if the setting indicates to do so. This distinguishes between implementations and implementors based on being descendants of certain named elements.
2021-05-20rustdoc: add tooltips to some buttonsLiigo Zhuang-1/+1
2021-05-18Add method-toggle to <details> for methods.Jacob Hoffman-Andrews-3/+6
The makes the code for handling "auto-hide" settings more consistent.
2021-05-18Rollup merge of #85280 - jsha:move-trait-toggles, r=GuillaumeGomezGuillaume Gomez-2/+7
Toggle-wrap items differently than top-doc. This makes sure things like trait methods get wrapped at the `<h3><code>` level rather than at the `.docblock` level. Also it ensures that only the actual top documentation gets the `.top-doc` class. Fixes #85167 Before: ![image](https://user-images.githubusercontent.com/220205/117743384-98790200-b1bb-11eb-8804-588530842514.png) https://doc.rust-lang.org/nightly/std/io/trait.Read.html#tymethod.read After: ![image](https://user-images.githubusercontent.com/220205/118410882-98a75080-b646-11eb-949d-ca688bab6923.png)
2021-05-16Auto merge of #85304 - Stupremee:crates-in-sidebar-in-root, r=Nemo157bors-3/+10
rustdoc: Call `initSidebarItems` in root module of crate r? `@jsha` Resolves #85301
2021-05-15Call `initSidebarItems` in root module of crateJustus K-3/+10
2021-05-15Minimize amount of fake `DefId`s used in rustdocJustus K-11/+9
2021-05-15rustdoc: update static filesShinwoo Park-0/+2
2021-05-13Toggle-wrap items differently than top-doc.Jacob Hoffman-Andrews-2/+7
This makes sure things like trait methods get wrapped at the `<h3><code>` level rather than at the `.docblock` level. Also it ensures that only the actual top documentation gets the `.top-doc` class.
2021-05-13Rollup merge of #85175 - GuillaumeGomez:rustdoc-cleanup, r=jshaGuillaume Gomez-15/+8
Rustdoc cleanup Part of https://github.com/rust-lang/rust/issues/83332. The goal of this PR is to remove a few unused things: * The "loading content" things are now unneeded. * Some toggle CSS rules were still there. * Some parts of the JS had a different indent, fixed it. r? `@jsha`
2021-05-12Rollup merge of #85141 - GuillaumeGomez:maybe_collapsed_doc_value-doc, r=jshaGuillaume Gomez-2/+2
Update documentation for SharedContext::maybe_collapsed_doc_value Fixes #85120. The `doc-collapse` was removed, however, the main crate is always "collapsed", meaning that this function is still needed. I updated the documentation instead to avoid misleading readers. r? `@jsha`
2021-05-12Auto merge of #83813 - cbeuw:remap-std, r=michaelwoeristerbors-2/+2
Fix `--remap-path-prefix` not correctly remapping `rust-src` component paths and unify handling of path mapping with virtualized paths This PR fixes #73167 ("Binaries end up containing path to the rust-src component despite `--remap-path-prefix`") by preventing real local filesystem paths from reaching compilation output if the path is supposed to be remapped. `RealFileName::Named` introduced in #72767 is now renamed as `LocalPath`, because this variant wraps a (most likely) valid local filesystem path. `RealFileName::Devirtualized` is renamed as `Remapped` to be used for remapped path from a real path via `--remap-path-prefix` argument, as well as real path inferred from a virtualized (during compiler bootstrapping) `/rustc/...` path. The `local_path` field is now an `Option<PathBuf>`, as it will be set to `None` before serialisation, so it never reaches any build output. Attempting to serialise a non-`None` `local_path` will cause an assertion faliure. When a path is remapped, a `RealFileName::Remapped` variant is created. The original path is preserved in `local_path` field and the remapped path is saved in `virtual_name` field. Previously, the `local_path` is directly modified which goes against its purpose of "suitable for reading from the file system on the local host". `rustc_span::SourceFile`'s fields `unmapped_path` (introduced by #44940) and `name_was_remapped` (introduced by #41508 when `--remap-path-prefix` feature originally added) are removed, as these two pieces of information can be inferred from the `name` field: if it's anything other than a `FileName::Real(_)`, or if it is a `FileName::Real(RealFileName::LocalPath(_))`, then clearly `name_was_remapped` would've been false and `unmapped_path` would've been `None`. If it is a `FileName::Real(RealFileName::Remapped{local_path, virtual_name})`, then `name_was_remapped` would've been true and `unmapped_path` would've been `Some(local_path)`. cc `@eddyb` who implemented `/rustc/...` path devirtualisation
2021-05-12Remove "loading content" which is now unnecessaryGuillaume Gomez-15/+8
2021-05-11Disable layout docs for type aliases for nowCamelid-2/+0
There are issues with computing layout for type aliases; see #85103. Once the issues are fixed, we should re-enable layout docs for them.
2021-05-11Add note to docs when layout cannot be computedCamelid-7/+26
This should prevent confusion about why generic types don't have layout docs.
2021-05-11Apply suggestions from code reviewCamelid-3/+4
Co-authored-by: Ivan Tham <pickfire@riseup.net>
2021-05-11Add `tcx` local variableCamelid-3/+4
2021-05-11Fix a few small thingsCamelid-6/+6
2021-05-11Only show type layout info if `--show-type-layout` is passedCamelid-0/+8
2021-05-11Show memory layout for type aliasesCamelid-1/+4
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 the layout of a generic type). So I think it's still useful to show layout info for type aliases.
2021-05-11Include a warning in the layout docs that layout is unstableCamelid-3/+12
2021-05-11Remove FIXMECamelid-2/+4
Layout errors can occur with valid code, e.g. generic types.
2021-05-11rustdoc: Show basic type layout informationCamelid-3/+36
Right now it just shows the size.
2021-05-10Rollup merge of #85148 - GuillaumeGomez:source-code-line-number, r=jshaGuillaume Gomez-0/+1
Fix source code line number display and make it clickable again Fixes https://github.com/rust-lang/rust/issues/85119. I used the same logic we're using for other codeblocks: putting the line number `<span>`s into the `example-wrap` directly and then add `display: inline-flex` on `example-wrap`. r? `@jsha`
2021-05-10Use an SVG image for clipboard instead of unicode characterGuillaume Gomez-3/+14
2021-05-10Fix line number not being clickable on source pagesGuillaume Gomez-0/+1
2021-05-10Update documentation for SharedContext::maybe_collapsed_doc_valueGuillaume Gomez-2/+2