about summary refs log tree commit diff
path: root/src/librustdoc/html
AgeCommit message (Collapse)AuthorLines
2021-01-15Improve JS performance by storing length before comparing to it in loopsGuillaume Gomez-56/+50
2021-01-15Rename VariantKind -> VariantJoshua Nelson-6/+6
There's no `Variant`, so it seems silly to have `Kind`.
2021-01-15Remove useless `clean::Variant` structJoshua Nelson-13/+10
It had exactly one field and no special behavior, so there was no point.
2021-01-09Replace under-used ImplPolarity enum with a booleanGuillaume Gomez-9/+4
2021-01-08Auto merge of #80653 - jryans:doc-deref-recursive, r=jyn514,GuillaumeGomezbors-84/+123
Recursively document methods via `Deref` traits This changes `rustdoc` to recursively follow `Deref` targets so that methods from all levels are added to the rendered output. This implementation displays the methods from all levels in the expanded state with separate sections for each level. ![image](https://user-images.githubusercontent.com/279572/103482863-46723b00-4ddb-11eb-972b-c463351a425c.png) Fixes https://github.com/rust-lang/rust/issues/26207 Fixes https://github.com/rust-lang/rust/issues/53038 Fixes https://github.com/rust-lang/rust/issues/71640 r? `@jyn514`
2021-01-08Combine several `push_str` callsJ. Ryan Stinnett-4/+3
2021-01-08Use target in `Deref` method section IDsJ. Ryan Stinnett-41/+51
There can now be multiple `Deref` method sections, so this adds the target type to the section ID to ensure they are unique.
2021-01-08Recursively document methods via `Deref` traitsJ. Ryan Stinnett-3/+33
2021-01-08Rollup merge of #80738 - arusahni:master, r=GuillaumeGomezYuki Okushi-0/+1
Remove bottom margin from crate version when the docs sidebar is collapsed This fixes a mobile UI bug where a vertical scrollbar would always be rendered on the sidebar nav when the menu was closed. When opened, the overflow would be handled by the opened sidebar, causing the scrollbar to disappear, and the contents to shift to the right. ## Firefox **Before** ![before-ff](https://user-images.githubusercontent.com/139487/103713599-c2f74c00-4f8a-11eb-88c0-d5c6c088f8a0.png) ![before](https://user-images.githubusercontent.com/139487/103713793-2bdec400-4f8b-11eb-8223-94b77cc05f71.gif) **After** ![after-ff](https://user-images.githubusercontent.com/139487/103713605-c8ed2d00-4f8a-11eb-9ee8-f86cafaa8775.png) ![after](https://user-images.githubusercontent.com/139487/103713805-31d4a500-4f8b-11eb-9e5b-4156402ca43e.gif) ## Chrome **Before** ![localhost_8000_unicode_xid_ (1)](https://user-images.githubusercontent.com/139487/103713626-d60a1c00-4f8a-11eb-8605-cc98e04e9ad0.png) **After** ![localhost_8000_unicode_xid_](https://user-images.githubusercontent.com/139487/103713622-d1456800-4f8a-11eb-8c66-7d19f81614ca.png)
2021-01-05Remove bottom margin from crate version when the sidebar is collapsed.Aru Sahni-0/+1
This fixes a mobile UI bug where a vertical scrollbar would always be rendered on the sidebar nav when the menu was closed.
2021-01-04Extract `sidebar_deref_methods` functionJ. Ryan Stinnett-52/+52
2021-01-04Auto merge of #80661 - jyn514:duplicate-types, r=GuillaumeGomezbors-0/+3
Cleanup rustdoc handling of associated types This is best reviewed a commit at a time. No particular reason for these changes, they just stood out as I was reviewing https://github.com/rust-lang/rust/pull/80653 and thinking about https://github.com/rust-lang/rust/issues/80379. The new test case worked before, it just wasn't tested. r? `@GuillaumeGomez`
2021-01-04Auto merge of #80554 - GuillaumeGomez:more-js-cleanup, r=jyn514bors-18/+12
More js cleanup Part of #79052 (Same kind as #80515). This one is about some small fixes: * Replacing some loops with `onEachLazy`. * Removing unused function arguments. * Turn `buildHelperPopup` into a variable so it can be "replaced" once the function has been called once so it's not called again. r? `@jyn514`
2021-01-03Simplify rustdoc handling of type aliases for associated typesJoshua Nelson-0/+3
The logic was very hard to follow before.
2021-01-03Auto merge of #77859 - bugadani:no-duplicate-ref-link-error, r=jyn514bors-7/+17
Rustdoc: only report broken ref-style links once This PR assigns the markdown `LinkType` to each parsed link and passes this information into the link collector. If a link can't be resolved in `resolve_with_disambiguator`, the failure is cached for the link types where we only want to report the error once (namely `Shortcut` and `Reference`). Fixes #77681
2021-01-03Only report reference-style link errors onceDániel Buga-7/+17
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2021-01-03Rollup merge of #80580 - GuillaumeGomez:suggestion-ignore-codeblock-warn, ↵Guillaume Gomez-3/+9
r=jyn514 Add suggestion for "ignore" doc code block Part of https://github.com/rust-lang/rust/issues/30032. This PR adds a suggestion to help users when they have a "ignore" doc code block which is invalid rust code. r? `@jyn514`
2021-01-03Inline resetMouseMoved function directly into "mousemove" event handlerGuillaume Gomez-5/+1
2021-01-03Replace some loops with "onEachLazy" callGuillaume Gomez-13/+11
2021-01-03Create a "is_ignore" variable instead of doing the comparison multiple timesGuillaume Gomez-3/+4
2021-01-03Auto merge of #80261 - GuillaumeGomez:attr-rework, r=jyn514bors-13/+8
rustdoc DocFragment rework Kind of a follow-up of #80119. A few things are happening in this PR. I'm not sure about the impact on perf though so I'm very interested about that too (if the perf is worse, then we can just close this PR). The idea here is mostly about reducing the memory usage by relying even more on `Symbol` instead of `String`. The only issue is that `DocFragment` has 3 modifications performed on it: 1. Unindenting 2. Collapsing similar comments into one 3. "Beautifying" (weird JS-like comments handling). To do so, I saved the information about unindent and the "collapse" is now on-demand (which is why I'm not sure the perf will be better, it has to be run multiple times...). r? `@jyn514`
2021-01-02Improve code for DocFragment reworkGuillaume Gomez-6/+2
2021-01-02Auto merge of #80412 - GuillaumeGomez:fix-search-section-pos, r=jyn514bors-1/+4
Fix search section position on small devices Fixes #79526. This is exactly the same issue fixed in 9c36491538476dd3ff5ec834944aacdaceb12f30 (in https://github.com/rust-lang/rust/pull/79936) but applied to the search section. When the width becomes too small, the search input goes on its own line to get more space, making it go "under" the section following (so either "main" or "search"). The fix is to simply make the section go more under so that it doesn't go over the search input. r? `@jyn514`
2021-01-02End of rework of Attributes structGuillaume Gomez-10/+9
2021-01-02Auto merge of #80550 - bugadani:markdown-refactor, r=jyn514bors-71/+84
Cleanup markdown span handling, take 2 This PR includes the cleanups made in #80244 except for the removal of `locate()`. While the biggest conceptual part in #80244 was the removal of `locate()`, it introduced a diagnostic regression. Additional cleanup: - Use `RefCell` to avoid building two separate vectors for the links Work to do: - [ ] Decide if `locate()` can be simplified by assuming `s` is always in `md` - [ ] Should probably add some tests that still provide the undesired diagnostics causing #80381 cc `@jyn514` This is the best I can do without patching Pulldown to provide multiple ranges for reference-style links. Also, since `locate` is probably more efficient than `rfind` (at least it's constant time), I decided to not check the link type and just cover every &str as it was before.
2021-01-02Rollup merge of #80546 - matthiaskrgr:rustdoclippy, r=LingManMara Bos-26/+23
clippy fixes for librustdoc fixes clippy warnings of type: match_like_matches_macro or_fun_call op_ref needless_return let_and_return single_char_add_str useless_format unnecessary_sort_by match_ref_pats redundant_field_names
2021-01-02Only use locate for borrowed stringsDániel Buga-7/+21
2021-01-01clippy fixes for librustdocMatthias Krüger-26/+23
fixes clippy warnings of type: match_like_matches_macro or_fun_call op_ref needless_return let_and_return single_char_add_str useless_format unnecessary_sort_by match_ref_pats redundant_field_names
2021-01-01Auto merge of #80569 - notriddle:patch-3, r=jyn514bors-7/+1
Use Array.prototype.filter instead of open-coding Part of #79052, originally suggested in https://github.com/rust-lang/rust/pull/79052#discussion_r523468743 by `@jyn514` Besides making main.js smaller (always a plus), this also performs better by using the optimized filter implementation in your browser's JavaScript engine (according to `@GuillaumeGomez,` an 84% performance improvement).
2021-01-01Add suggestion in case a "ignore" doc block has invalid rust code insideGuillaume Gomez-3/+8
2020-12-31Use Array.prototype.filter instead of open-codingMichael Howell-7/+1
Part of #79052, originally suggested in https://github.com/rust-lang/rust/pull/79052#discussion_r523468743 Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-12-31Rollup merge of #80368 - camelid:rustdoc-succinct-vis, r=jyn514Dylan DPC-38/+65
rustdoc: Render visibilities succinctly Fixes #79139. r? `@jyn514`
2020-12-31Add FIXME for visibility of a moduleCamelid-0/+3
2020-12-31Collect links into a single vectorDániel Buga-7/+5
2020-12-31Always provide a rangeDániel Buga-7/+7
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-12-31Remove unnecessary scopeDániel Buga-36/+33
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-12-31Use ranges returned by pulldownDániel Buga-31/+35
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-12-30Update `find_nearest_parent_module`Camelid-3/+3
2020-12-30Rollup merge of #80495 - jyn514:rename-empty, r=petrochenkovMara Bos-3/+3
Rename kw::Invalid -> kw::Empty See https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Is.20there.20a.20symbol.20for.20the.20empty.20string.3F/near/220054471 for context. r? `@petrochenkov`
2020-12-30Rename kw::Invalid -> kw::EmptyJoshua Nelson-3/+3
See https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Is.20there.20a.20symbol.20for.20the.20empty.20string.3F/near/220054471 for context.
2020-12-30Rollup merge of #80509 - matthiaskrgr:ptr_arg, r=varkorYuki Okushi-1/+1
where possible, pass slices instead of &Vec or &String (clippy::ptr_arg)
2020-12-30Rollup merge of #80381 - rust-lang:revert-80244-spans, r=GuillaumeGomezYuki Okushi-61/+65
Revert "Cleanup markdown span handling" Reverts rust-lang/rust#80244. This caused a diagnostic regression, originally it was: ``` warning: unresolved link to `std::process::Comman` --> link.rs:3:10 | 3 | //! [a]: std::process::Comman | ^^^^^^^^^^^^^^^^^^^^ no item named `Comman` in module `process` | = note: `#[warn(broken_intra_doc_links)]` on by default ``` but after that PR rustdoc now displays ``` warning: unresolved link to `std::process::Comman` --> link.rs:1:14 | 1 | //! Links to [a] [link][a] | ^^^ no item named `Comman` in module `process` | = note: `#[warn(broken_intra_doc_links)]` on by default ``` which IMO is much less clear. cc `@bugadani,` thanks for catching this in https://github.com/rust-lang/rust/pull/77859. r? `@GuillaumeGomez`
2020-12-30If the current search result tab is empty, it picks the first non-empty one. ↵Guillaume Gomez-0/+15
If all are empty, the current one doesn't change.
2020-12-30where possible, pass slices instead of &Vec or &String (clippy::ptr_arg)Matthias Krüger-1/+1
2020-12-30Rollup merge of #80482 - matthiaskrgr:cl0ne_on_copy, r=jyn514Yuki Okushi-2/+2
don't clone copy types r? `@Dylan-DPC`
2020-12-30Rollup merge of #80472 - GuillaumeGomez:sans-serif-for-all-items-page, r=Nemo157Yuki Okushi-1/+3
Use sans-serif font for the "all items" page links The "all items" pages' links aren't using a sans-serif font unlike the rest of equivalent items in the other module pages. ``@Nemo157`` reported me this issue so here is the fix! r? ``@Nemo157``
2020-12-29Remove trailing semicolon in librustdocAaron Hill-1/+1
2020-12-29don't clone copy typesMatthias Krüger-2/+2
2020-12-29Use sans-serif font for the "all items" page linksGuillaume Gomez-1/+3
2020-12-29Fix search section position on small devicesGuillaume Gomez-1/+4