summary refs log tree commit diff
path: root/src/librustdoc/html
AgeCommit message (Collapse)AuthorLines
2021-03-10Add testDániel Buga-0/+11
(cherry picked from commit d3f75ebf609eed01b39fb7528745f2fce88e33e6)
2021-03-10Remove duplicate stringDániel Buga-1/+0
(cherry picked from commit 3be69b100f6678c42eff36e18505c2ba9419647a)
2021-02-05Rollup merge of #81497 - camelid:rustdoc-display_fn-remove-cell, r=jyn514Mara Bos-11/+11
rustdoc: Move `display_fn` struct inside `display_fn` This makes it clear that it's an implementation detail of `display_fn` and shouldn't be used elsewhere, and it enforces in the compiler that no one else can use it. r? ````@GuillaumeGomez````
2021-02-03Rollup merge of #81681 - Smittyvb:rustdoc-shortcuts-styling, r=GuillaumeGomezGuillaume Gomez-2/+2
Better styling of "Switch result tab" shortcut Before: ![](https://user-images.githubusercontent.com/10530973/106663877-544de400-6572-11eb-98a4-77b6b3d9cd42.png) ![image](https://user-images.githubusercontent.com/10530973/106664790-8d3a8880-6573-11eb-811f-29c4ade31848.png) After: ![](https://user-images.githubusercontent.com/10530973/106663945-6b8cd180-6572-11eb-911a-12c69d935ee5.png) ![](https://user-images.githubusercontent.com/10530973/106664403-05547e80-6573-11eb-84bf-fdd0dfc7dac8.png)
2021-02-03Rollup merge of #81679 - GuillaumeGomez:clean-fixme-match-bind, ↵Guillaume Gomez-2/+10
r=poliorcetics,CraftSpider Bind all clean::Type variants and remove FIXME This is simply a little cleanup. cc `@CraftSpider` r? `@poliorcetics`
2021-02-02Better styling of "Switch result tab" shortcutSmitty-2/+2
2021-02-02Bind all clean::Type variants and remove FIXMEGuillaume Gomez-2/+10
2021-02-02Rollup merge of #81630 - GuillaumeGomez:overflow-sidebar-title-text, r=pickfireJonas Schievink-0/+8
Fix overflowing text on mobile when sidebar is displayed Fixes #81597. Before: ![Screenshot from 2021-02-01 17-21-15](https://user-images.githubusercontent.com/3050060/106486857-610b0300-64b2-11eb-96d3-12b939f5b661.png) After: ![Screenshot from 2021-02-01 17-20-59](https://user-images.githubusercontent.com/3050060/106486840-5cdee580-64b2-11eb-9492-4df27bb39e59.png) cc `@pickfire` r? `@Nemo157`
2021-02-02Rollup merge of #81492 - camelid:rustdoc-internal-mod-vis, r=GuillaumeGomezJonas Schievink-0/+1
rustdoc: Note why `rustdoc::html::markdown` is public Almost all of the modules are crate-private, except for `rustdoc::json::types`, which I believe is intended to be for public use; and `rustdoc::html::markdown`, which is used externally by the error-index generator and so has to be public. r? ``@GuillaumeGomez``
2021-02-02Auto merge of #81557 - GuillaumeGomez:primitive-search, r=ollie27bors-1/+1
Fix primitive search in parameters and returned values Part of #60485. Fixes #74780. Replacing #74879. cc `@camelid` `@jyn514` `@CraftSpider` r? `@ollie27`
2021-02-01Fix overflowing text on mobile when sidebar is displayedGuillaume Gomez-0/+8
2021-02-01Put back primitives in searchGuillaume Gomez-1/+1
2021-02-01Rollup merge of #81592 - GuillaumeGomez:rustdoc-ui-fixes, r=Nemo157Jonas Schievink-11/+2
Rustdoc UI fixes The first commit fixes this bug (I couldn't figure out why we were setting the width manually and it works as expected without so...): ![Screenshot from 2021-01-31 12-58-46](https://user-images.githubusercontent.com/3050060/106384371-d56a7700-63ca-11eb-9e04-c06b40c2ab5e.png) The second commit fixes a small bug. On tablets or computer with very little width, the search section goes "over" the search input, making it impossible to click on the search input: ![Screenshot from 2021-01-31 13-22-37](https://user-images.githubusercontent.com/3050060/106384413-021e8e80-63cb-11eb-8321-391a1f8a4c7e.png) The third and last commit fixes two bugs that you can see in this screenshot: ![Screenshot from 2021-01-31 13-41-05](https://user-images.githubusercontent.com/3050060/106384424-0cd92380-63cb-11eb-82de-76218286c3fb.png) The wheel is going over the search input and the search tab is going under the search results text. The bug was fixed by simply switching to "mobile mode" at a bigger width: ![Screenshot from 2021-01-31 13-49-50](https://user-images.githubusercontent.com/3050060/106384466-4447d000-63cb-11eb-9330-a7cd29403905.png) cc ```@pickfire``` r? ```@Nemo157```
2021-01-31rustdoc: Note why `rustdoc::html::markdown` is publicCamelid-0/+1
Almost all of the modules are crate-private, except for `rustdoc::json::types`, which I believe is intended to be for public use; and `rustdoc::html::markdown`, which is used externally by the error-index generator and so has to be public.
2021-01-31Improve resize handlingGuillaume Gomez-1/+1
2021-01-31Prevent search section to go over search inputGuillaume Gomez-1/+1
2021-01-31Remove unneeded explicit width from search resultsGuillaume Gomez-9/+0
2021-01-31Rollup merge of #81563 - pickfire:patch-6, r=GuillaumeGomezJonas Schievink-0/+4
Improve docblock readability on small screen Before ![image](https://user-images.githubusercontent.com/4687791/106363174-f77bdf00-6361-11eb-898f-d480b8460ab3.png) After ![image](https://user-images.githubusercontent.com/4687791/106363259-6bb68280-6362-11eb-85a1-ef9262681dd7.png) Too much space is wasted on the left side. I wanted to make that 0 but it breaks some part with error symbols. 0 ![image](https://user-images.githubusercontent.com/4687791/106363287-90aaf580-6362-11eb-88c1-62a8313988a7.png) After ![image](https://user-images.githubusercontent.com/4687791/106363276-825cd980-6362-11eb-86eb-6f4611b4ab99.png)
2021-01-31Rollup merge of #81558 - pickfire:patch-5, r=GuillaumeGomezJonas Schievink-1/+2
Fix ascii art text wrapping in mobile Fix #81377 Before ![image](https://user-images.githubusercontent.com/4687791/106362405-a1a53800-635d-11eb-87b9-2f40bbd023bf.png) ![image](https://user-images.githubusercontent.com/4687791/106362410-aa960980-635d-11eb-96ee-979251b213a3.png) ![image](https://user-images.githubusercontent.com/4687791/106362562-80911700-635e-11eb-97ee-b19a6ea2fc6d.png) After ![image](https://user-images.githubusercontent.com/4687791/106362428-b4b80800-635d-11eb-8d5b-e4f51f5501ee.png) ![image](https://user-images.githubusercontent.com/4687791/106362433-bbdf1600-635d-11eb-96af-7043c74b3a0a.png) ![image](https://user-images.githubusercontent.com/4687791/106362570-8f77c980-635e-11eb-928d-ef1d26c13136.png) Note the second image is scrolled to the back (right), I added some padding for the text block (not the code block) to make it more comfortable to read since the last character is stuck to the last character.
2021-01-31Remove extra trailing spacesIvan Tham-1/+1
2021-01-31Fix docblock short code missing end whitespacesIvan Tham-0/+3
2021-01-31Improve docblock readability on small screenIvan Tham-0/+4
2021-01-31Fix ascii art text wrapping in mobileIvan Tham-3/+1
Fix #81377
2021-01-30Balance sidebar `Deref` cycle check with main contentJ. Ryan Stinnett-7/+11
The `Deref` cycle checks added as part of #80653 were "unbalanced" in the sense that the main content code path checks for cycles _before_ descending, while the sidebar checks _after_. Checking _before_ is correct, so this changes the sidebar path to match the main content path.
2021-01-30rustdoc tweakingbors-418/+436
* Reuse memory * simplify `next_def_id`, avoid multiple hashing and unnecessary lookups * remove `all_fake_def_ids`, use the global map instead (probably not a good step toward parallelization, though...) * convert `add_deref_target` to iterative implementation * use `ArrayVec` where we know the max number of elements * minor touchups here and there * avoid building temporary vectors that get appended to other vectors At most places I may or may not be doing the compiler's job is this PR.
2021-01-29rustdoc: Move `display_fn` struct inside `display_fn`Camelid-11/+11
This makes it clear that it's an implementation detail of `display_fn` and shouldn't be used elsewhere, and it enforces in the compiler that no one else can use it.
2021-01-29Rollup merge of #81459 - probablykasper:text-selection-fix, r=Nemo157Yuki Okushi-32/+32
Fix rustdoc text selection for page titles Fixes text selection of page titles by placing the `h1.fqn span.in-band` element before `h1.fqn span.out-of-band`. Before vs after: https://user-images.githubusercontent.com/11315492/105768203-55708700-5f5c-11eb-924b-4e7527ffe147.mp4 Retry of PR #81397 due to merge conflicts confusing me. Recreated the same changes as in that PR, but now when I run `./x.py doc library/std`, no changes I make to `src/librustdoc/html/render/mod.rs` to the file are reflected in the built doc files, even if I delete the `build` folder. I'm guessing there's some cache I'm missing? r? `@Nemo157`
2021-01-29Rollup merge of #79991 - camelid:rustdoc-for-lifetime, r=GuillaumeGomez,jyn514Yuki Okushi-6/+15
rustdoc: Render HRTB correctly for bare functions The angle brackets were not rendered, so code like this: some_func: for<'a> fn(val: &'a i32) -> i32 would be rendered as: some_func: fn'a(val: &'a i32) -> i32 However, rendering with angle brackets is still invalid syntax: some_func: fn<'a>(val: &'a i32) -> i32 so now it renders correctly as: some_func: for<'a> fn(val: &'a i32) -> i32 ----- However, note that this code: some_trait: dyn for<'a> Trait<'a> will still render as: some_trait: dyn Trait<'a> which is not invalid syntax, but is still unclear. Unfortunately I think it's hard to fix that case because there isn't enough information in the `rustdoc::clean::Type` that this code operates on. Perhaps that case can be fixed in a later PR. r? ``@jyn514``
2021-01-28Rollup merge of #81379 - GuillaumeGomez:improve-urls, r=Nemo157Yuki Okushi-7/+17
Improve URLs handling Fixes #81330. Explanations: before this PR, when emptying the search input, we still had `?search=` in the URL, which wasn't very nice. Now, if the search is empty, we drop the `?search=` part. Also, I realized while working on this PR that when we clicked on a menu link when we were on the search results, the search parameters would look like: `?search=#the-anchor`, which was super weird. Now, it looks like this: `?search=the-search#the-anchor`. Also, I didn't use the `Url` very nice API because it's not available in any IE version (sadness...). cc `````@lzutao````` r? `````@Nemo157`````
2021-01-27rustdoc: Render HRTB correctly for bare functionsCamelid-6/+15
The angle brackets were not rendered, so code like this: some_func: for<'a> fn(val: &'a i32) -> i32 would be rendered as: some_func: fn'a(val: &'a i32) -> i32 However, rendering with angle brackets is still invalid syntax: some_func: fn<'a>(val: &'a i32) -> i32 so now it renders correctly as: some_func: for<'a> fn(val: &'a i32) -> i32 ----- However, note that this code: some_trait: dyn for<'a> Trait<'a> will still render as: some_trait: dyn Trait<'a> which is not invalid syntax, but is still unclear. Unfortunately I think it's hard to fix that case because there isn't enough information in the `rustdoc::clean::Type` that this code operates on. Perhaps that case can be fixed in a later PR.
2021-01-28Fix rustdoc page title text selectionKasper-32/+32
2021-01-27More cleanupGuillaume Gomez-5/+2
2021-01-27Unify cache usage and improve namingGuillaume Gomez-11/+12
2021-01-27Update to new rustdoc APIsGuillaume Gomez-1/+1
2021-01-27Apply review comments and improve codeGuillaume Gomez-1/+1
2021-01-27Remove cache usage wherever possibleGuillaume Gomez-30/+38
2021-01-27Remove CACHE_KEY globalGuillaume Gomez-518/+575
2021-01-27Rollup merge of #81299 - GuillaumeGomez:fix-eslint-detected-bugs, r=Nemo157Yuki Okushi-31/+33
Fix some bugs reported by eslint Simply went into `src/librustdoc/html/static/` and ran `eslint *.js` in case you want to reproduce. :) r? ``````@Nemo157``````
2021-01-25Improve URL handling when clicking on a menu link while being on the search ↵Guillaume Gomez-7/+16
results and overall
2021-01-25Completely remove search query parameter when clearing search inputGuillaume Gomez-1/+2
2021-01-25Fix some bugs reported by eslintGuillaume Gomez-31/+33
2021-01-24Rollup merge of #81302 - LeSeulArtichaut:80777-trait-render, r=jyn514Jonas Schievink-30/+21
Fix rendering of stabilization version for trait implementors Rustdoc compares an item's stabilization version with its parent's to not render it if they are the same. Here, the implementor was compared with itself, resulting in the stabilization version never getting shown. This probably needs a test. Fixes #80777. r? `@jyn514`
2021-01-23Fix rendering of stabilization version for trait implementorsLeSeulArtichaut-4/+4
2021-01-23Rollup merge of #81275 - jyn514:time-render, r=wesleywiserJonas Schievink-0/+4
Fix <unknown> queries and add more timing info to render_html Closes https://github.com/rust-lang/rust/issues/81251. ## Fix `<unknown>` queries This happened because `alloc_query_strings` was never called. ## Add more timing info to render_html This still has some issues I'm not sure how to work out: - `create_renderer` and `renderer_after_krate` aren't shown by default. I want something like `verbose_generic_activity_with_arg`, but it doesn't exist. I'm also not sure how to show activities that aren't on by default - I tried `-Z self-profile -Z self-profile-args=all`, but it didn't show up. r? `@wesleywiser`
2021-01-23Cleanup `render_stability_since_raw` to remove code duplicationLeSeulArtichaut-26/+17
2021-01-23Add more timing info to render_htmlJoshua Nelson-0/+4
- Show `create_renderer` and `renderer_after_crate` by default - Don't rewrite `extra_verbose_generic_activity`
2021-01-22Rollup merge of #81227 - CraftSpider:struct-type-clean, r=jyn514Mara Bos-7/+7
Remove doctree::StructType Also removes it from the Union type, as unions can only ever be 'Plain'. Adds a new StructType to JSON, 'union', as the easiest way to encode the type of a union there. This leaves only one item in doctree, `Module`. r? `@jyn514`
2021-01-21Fix rustc::internal lints on rustdocJoshua Nelson-12/+12
2021-01-21Rollup merge of #81184 - jyn514:combine-after, r=CraftSpiderYuki Okushi-12/+15
Remove unnecessary `after_run` function It's called at the same time and in the same place as `after_krate`, so they can be combined.
2021-01-20Remove StructType entirely and replace it with CtorKindRune Tynan-6/+7