about summary refs log tree commit diff
path: root/src/librustdoc/html
AgeCommit message (Collapse)AuthorLines
2021-12-23Auto merge of #92177 - GuillaumeGomez:pattern-matching-outside-loop, r=camelidbors-6/+8
Move pattern matching outside of the loop Not sure if worth it but it's been bugging me for a while now. r? `@camelid`
2021-12-23Rollup merge of #92146 - willcrichton:example-analyzer, r=jyn514Matthias Krüger-6/+10
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`
2021-12-22Add some JSDoc comments to rustdoc JSJacob Hoffman-Andrews-30/+170
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.
2021-12-21Move pattern matching outside of the loopGuillaume Gomez-6/+8
2021-12-20Move duplicates removal when generating results instead of when displaying themGuillaume Gomez-11/+13
2021-12-19Auto merge of #92099 - matthiaskrgr:rollup-4gwv67m, r=matthiaskrgrbors-11/+2
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
2021-12-19Rollup merge of #92077 - jyn514:remove-collapsed, r=GuillaumeGomezMatthias Krüger-11/+2
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.
2021-12-19Auto merge of #91957 - nnethercote:rm-SymbolStr, r=oli-obkbors-41/+39
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`
2021-12-19Auto merge of #91871 - camelid:urlpartsbuilder, r=GuillaumeGomezbors-17/+192
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`.
2021-12-18Remove `collapsed` fieldJoshua Nelson-11/+2
`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.
2021-12-18Rollup merge of #91977 - GuillaumeGomez:unify-search-code, r=jshaMatthias Krüger-110/+102
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`
2021-12-17Auto merge of #91812 - camelid:assoc-const-lazy, r=GuillaumeGomezbors-12/+4
rustdoc: Pretty-print assoc const defaults on-demand This should improve performance, clean up the code, and help pave the way for #83035.
2021-12-16Make loop more clear by renaming variablesGuillaume Gomez-4/+8
2021-12-16Clean up search code and unify function returned valuesGuillaume Gomez-108/+96
2021-12-16Rollup merge of #91958 - jsha:rust-logo, r=GuillaumeGomezMatthias Krüger-18/+14
Apply rust-logo class only on default logo Fixes #91653. ![image](https://user-images.githubusercontent.com/220205/146138145-a7a62ea6-3205-4bc7-8460-e985284d93ea.png) Demo: https://rustdoc.crud.net/jsha/hashes/sha2/ r? ``@GuillaumeGomez``
2021-12-15Apply rust-logo class only on default logoJacob Hoffman-Andrews-18/+14
Also replace ' with " in rustdoc template
2021-12-15Auto merge of #91962 - matthiaskrgr:rollup-2g082jw, r=matthiaskrgrbors-3/+3
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
2021-12-15Rollup merge of #91880 - matthiaskrgr:clippy_perf_dec, r=jyn514Matthias Krüger-3/+3
fix clippy::single_char_pattern perf findings
2021-12-15Rollup merge of #91905 - GuillaumeGomez:source-code-page-sidebar, r=jshaMatthias Krüger-2/+10
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`
2021-12-15Remove unnecessary sigils around `Symbol::as_str()` calls.Nicholas Nethercote-24/+24
2021-12-15Remove `SymbolStr`.Nicholas Nethercote-17/+15
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`!
2021-12-14fix clippy::single_char_pattern perf findingsMatthias Krüger-3/+3
2021-12-14Fix sidebar in source code pageGuillaume Gomez-2/+10
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