about summary refs log tree commit diff
path: root/src/librustdoc/html
AgeCommit message (Collapse)AuthorLines
2021-12-13rustdoc: Add `UrlPartsBuilder`Noah Lev-17/+192
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`.
2021-12-13Rollup merge of #91699 - jsha:webkit-appearance-search-input, r=GuillaumeGomezMatthias Krüger-0/+4
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
2021-12-12Add -webkit-appearance: none to search inputJacob Hoffman-Andrews-0/+4
This fixes an issue when displaying on iPad, where the search box had no borders.
2021-12-11rustdoc: Remove unused `_default` parameterNoah Lev-12/+4
It can always be re-added later if we decide to display associated const default values.
2021-12-11rustdoc: Pretty-print assoc const defaults on-demandNoah Lev-1/+1
This should improve performance, clean up the code, and help pave the way for #83035.
2021-12-11Don't emit shared files when scraping dependenciesWill Crichton-6/+10
2021-12-11Rollup merge of #91682 - camelid:alias-layout, r=jyn514Matthias Krüger-0/+1
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).
2021-12-10Split CSS classes for "typedef" vs "associatedtype".Jacob Hoffman-Andrews-9/+25
2021-12-08rustdoc: Show type layout for type aliasesNoah Lev-0/+1
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).
2021-12-08Rollup merge of #91667 - GuillaumeGomez:fix-index-itemtypes, r=notriddleMatthias Krüger-26/+28
Fix indent of itemTypes in search.js It has been bugging me for quite some time now. Finally took the time to clean it up a bit. r? ```@notriddle```
2021-12-08Rollup merge of #91534 - jsha:heading-color, r=GuillaumeGomezMatthias Krüger-4/+4
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)
2021-12-08Change associated type to use link colorJacob Hoffman-Andrews-5/+5
2021-12-08Fix indent of itemTypes in search.jsGuillaume Gomez-26/+28
2021-12-07Add missing whitespace before disabled HTML attributeGuillaume Gomez-1/+1
2021-12-05Auto merge of #91356 - GuillaumeGomez:improve-rustdoc-layout, r=jshabors-170/+279
Improve rustdoc layout This is an overtake of https://github.com/rust-lang/rust/pull/89385 originally written by `@cynecx.` I kept the original commit and simply added the missing fixes into a new one. You can test it online [here](https://rustdoc.crud.net/imperio/improve-rustdoc-layout/std/index.html). r? `@jsha`
2021-12-04Make rustdoc headings black, and markdown blueJacob Hoffman-Andrews-4/+4
2021-12-03Remove single-use `GenericParamDef::get_type` functionNoah Lev-13/+13
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.
2021-12-03rustdoc: Remove single-use `Lifetime::get_ref()` functionNoah Lev-1/+1
2021-12-03Use fewer colors in rustdoc UIJacob Hoffman-Andrews-57/+55
This reduces visual distractions when reading method signatures.
2021-12-03Rollup merge of #91170 - jsha:preload-fonts, r=GuillaumeGomezMatthias Krüger-0/+6
rustdoc: preload fonts Follow-up from #82315. I noticed that font loading was so slow that even when loading from local disk, we get a flash of unstyled text (FOUT) followed by a reflow when the fonts load. With this change, we reliably get the appropriate fonts in the first render pass when loading locally, and we get it some of the time when loading from a website. This only preloads woff2 versions. According to https://caniuse.com/?search=preload and https://caniuse.com/?search=woff2, all browsers that support preload also support woff2, so this is fine; we will never load two copies of a font. Don't preload italic font faces because they aren't used on all pages. Demo: https://rustdoc.crud.net/jsha/preload-fonts/std/string/struct.String.html
2021-12-02Rollup merge of #89954 - GuillaumeGomez:legacy-const-generic-doc, r=AmanieuMatthias Krüger-0/+4
Fix legacy_const_generic doc arguments display Fixes https://github.com/rust-lang/rust/issues/83167. cc ``@Amanieu``
2021-12-02Rename CSS class main-inner into width-limiterGuillaume Gomez-4/+4
2021-12-02Rename ID "main" into "main-content"Guillaume Gomez-24/+25
2021-12-02Fix remaining bugsGuillaume Gomez-7/+21
2021-12-02Transform const generics if the function uses rustc_legacy_const_genericsGuillaume Gomez-0/+4
2021-12-02Auto merge of #91291 - GuillaumeGomez:const-deref-method, r=camelidbors-29/+78
Fix const deref methods display Fixes https://github.com/rust-lang/rust/issues/90855 (more information in the issue). r? `@camelid`
2021-12-01address reviewb-naber-1/+1
2021-12-01more fixed issuesb-naber-0/+7
2021-11-30Return ConstStability instead of &ConstStability in Item::const_stabilityGuillaume Gomez-6/+3
2021-11-30Improve code by replacing &str with Symbol in render_stability_since_rawGuillaume Gomez-15/+11
2021-11-30Fix display for "const" deref methods in rustdocGuillaume Gomez-14/+70
2021-11-29Only show notable traits if both types are the sameMichael Howell-1/+8
Checking only their DefId doesn't work because all slices have the same fake DefId. Fixes #91347
2021-11-29rustdoc: show logo in source sub navcynecx-40/+87
2021-11-29rustdoc: rework source sidebarcynecx-47/+57
2021-11-29rustdoc: fix tabs in csscynecx-5/+5
2021-11-29rustdoc: don't use overflow for main, instead make the sidebar stickycynecx-16/+14
2021-11-29rustdoc: make source sidebar collapse by defaultcynecx-1/+1
2021-11-29rustdoc: fix theme colorscynecx-3/+3
2021-11-29rustdoc: merge source sidebar into main sidebarcynecx-51/+41
2021-11-29rustdoc: fix source viewcynecx-11/+61
2021-11-29rustdoc: use flexbox to layout sidebar and main contentcynecx-81/+80
2021-11-27Rollup merge of #91062 - jsha:static-file-replace, r=jyn514,GuillaumeGomezMatthias Krüger-129/+112
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``
2021-11-26Rollup merge of #91223 - GuillaumeGomez:headings-indent, r=jshaMatthias Krüger-4/+6
Fix headings indent Fixes #91200. Screenshots with the fix: ![Screenshot from 2021-11-25 15-32-35](https://user-images.githubusercontent.com/3050060/143462481-f7e9ea13-72d5-46fe-90e0-9527e74599e3.png) ![Screenshot from 2021-11-25 15-32-49](https://user-images.githubusercontent.com/3050060/143462485-c010716a-0276-421b-a777-afff19c81c96.png) If the first element of a top docblock is a heading, we still need to keep the indent, but only on this one (I added a test to check it). We need it because otherwise the anchor will go over the `[-]` toggle. cc `@camelid` r? `@jsha`
2021-11-26Rollup merge of #91197 - camelid:rename-resolvedpath, r=GuillaumeGomez,jyn514Matthias Krüger-11/+10
rustdoc: Rename `Type::ResolvedPath` to `Type::Path` and don't re-export it The new name is shorter, simpler, and consistent with `hir::Ty`. It can't be re-exported since the name would conflict with the `clean::Path` struct. But usually enum variants are referred to using their qualified names in Rust anyway (and parts of rustdoc already do that with `clean::Type`), so this is also more consistent with the language. r? `@GuillaumeGomez` cc `@jyn514`
2021-11-26Rename `Type::ResolvedPath` to `Type::Path`Noah Lev-19/+19
At last! The new name is shorter, simpler, and consistent with `hir::Ty`.
2021-11-26Update the first heading indent rule so it is only applied on the first ↵Guillaume Gomez-4/+6
heading of the top doc block
2021-11-26Rollup merge of #91225 - GuillaumeGomez:source-page-scrollbar, r=jshaMatthias Krüger-0/+4
Fix invalid scrollbar display on source code page Fixes bug introduced in #90983: ![Screenshot from 2021-11-25 17-01-08](https://user-images.githubusercontent.com/3050060/143473753-c2e7c43c-ce3f-474d-9d2a-922e63189c51.png) ![Screenshot from 2021-11-25 17-07-08](https://user-images.githubusercontent.com/3050060/143473757-eecaaf2b-f4f0-49e0-a159-ab485e3f7122.png) To fix it, I simply unset the `overflow-y` on the source code page so it's not displayed anymore. r? ``@jsha``
2021-11-25Stop re-exporting `Type::ResolvedPath`Noah Lev-16/+15
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.
2021-11-25Fix invalid scrollbar display on source code pageGuillaume Gomez-0/+4
2021-11-25Auto merge of #91195 - camelid:path-did, r=jyn514bors-10/+23
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`