about summary refs log tree commit diff
path: root/src/librustdoc/html/render
AgeCommit message (Collapse)AuthorLines
2023-04-01a couple clippy::complexity fixesMatthias Krüger-5/+2
map_identity filter_next option_as_ref_deref unnecessary_find_map redundant_slicing unnecessary_unwrap bool_comparison derivable_impls manual_flatten needless_borrowed_reference
2023-03-26rustdoc: tweak `some variants omitted`Ezra Shaw-1/+1
Don't display `// some variants omitted` if enum is marked `#[non_exhaustive]`
2023-03-24Auto merge of #109399 - petrochenkov:rendersort, r=GuillaumeGomezbors-7/+20
rustdoc: Optimize impl sorting during rendering This should fix the perf regression on [bitmaps-3.1.0](https://github.com/rust-lang/rustc-perf/tree/master/collector/compile-benchmarks/bitmaps-3.1.0) from https://github.com/rust-lang/rust/pull/107765. The bitmaps crate has a lot of impls: ```rust impl Bits for BitsImpl<1> { ... } impl Bits for BitsImpl<2> { ... } // ... impl Bits for BitsImpl<1023> { ... } impl Bits for BitsImpl<1024> { ... } ``` and the logic in `fn print_item` sorts them in natural order. Before https://github.com/rust-lang/rust/pull/107765 the impls came in source order, which happened to be already sorted in the necessary way. So the comparison function was called fewer times. After https://github.com/rust-lang/rust/pull/107765 the impls came in "stable" order (based on def path hash). So the comparison function was called more times to sort them. The comparison function was terribly inefficient, so it caused a large perf regression. This PR attempts to make it more efficient by using cached keys during sorting.
2023-03-22Rollup merge of #108954 - notriddle:notriddle/notable-trait-generic, r=camelidMatthias Krüger-2/+2
rustdoc: handle generics better when matching notable traits This commit makes the `clean::Type::is_same` non-commutative (renaming it `is_doc_subtype_of`), so that a generic `impl` matches a concrete return, but a generic return does not match a concrete `impl`. It makes slice and vector Write for `u8` not match on every generic return value. Fixes #100322 Fixes #55082 Preview: * https://notriddle.com/rustdoc-demo-html-3/notable-trait-generic/std/vec/struct.Vec.html#method.new * https://notriddle.com/rustdoc-demo-html-3/notable-trait-generic/std/vec/struct.Vec.html#method.from-12 * https://notriddle.com/rustdoc-demo-html-3/notable-trait-generic/std/iter/trait.Iterator.html#method.intersperse_with * https://notriddle.com/rustdoc-demo-html-3/notable-trait-generic/std/string/struct.String.html#method.as_bytes
2023-03-20rustdoc: Optimize impl sorting during renderingVadim Petrochenkov-7/+20
2023-03-17extra_info_tags don't return string, use display_fnklensy-35/+56
2023-03-16clean up few allocklensy-1/+1
2023-03-16Rollup merge of #108875 - notriddle:notriddle/return-trait, r=GuillaumeGomezMatthias Krüger-2/+7
rustdoc: fix type search for `Option` combinators
2023-03-12rustdoc: rename `Type::is_same` to `is_doc_subtype_of`Michael Howell-2/+2
2023-03-11Rollup merge of #108784 - clubby789:askama-sidebar, r=jsha,GuillaumeGomezMatthias Krüger-644/+579
rustdoc: Migrate sidebar rendering to Askama cc #108757 Renders the sidebar for documentation using an Askama template
2023-03-11Rollup merge of #108757 - clubby789:askama-move, r=notriddle,jsha,GuillaumeGomezMatthias Krüger-43/+54
rustdoc: Migrate `document_item_info` to Askama https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/rustdoc.20allocations.20are.20slow Hoping to piece-by-piece migrate things to template. Had a few failed attempts at more complex parts of the code, so this is just a start.
2023-03-11Rollup merge of #107629 - pitaj:rustdoc-search-deprecated, r=jshaMatthias Krüger-5/+28
rustdoc: sort deprecated items lower in search closes #98759 ### Screenshots `i32::MAX` show sup above `std::i32::MAX` and `core::i32::MAX` ![image](https://user-images.githubusercontent.com/803701/216725619-40afb7b0-e984-4a2e-ab5b-a95b24736b0e.png) If just searching for `min`, the deprecated results show up far below other things: ![image](https://user-images.githubusercontent.com/803701/216725672-e4325d37-9bfe-47eb-a1fe-0e57092aa811.png) one page later ![image](https://user-images.githubusercontent.com/803701/216725932-cd1c4a42-d527-44fb-a4ab-5a6d243659cc.png) ~~And, as you can see, the "Deprecation planned" message shows up in the search results. The same is true for fully-deprecated items like `mem::uninitialized`: ![image](https://user-images.githubusercontent.com/803701/216726268-1657e77a-563f-45a0-85a7-3a0cf4d66d6f.png)~~ Edit: the deprecation message change was removed from this PR. Only the sorting is changed.
2023-03-10Render doc sidebar using Askamaclubby789-644/+579
2023-03-10Migrate `document_item_info` to templatesclubby789-43/+54
2023-03-10rustdoc: sort deprecated items lower in searchPeter Jaszkowiak-5/+28
serialize `q` (`itemPaths`) sparsely overall 4% reduction in search index size
2023-03-09rustdoc: handle generics better when matching notable traitsMichael Howell-2/+2
This commit makes the `clean::Type::is_same` non-commutative, so that a generic `impl` matches a concrete return, but a generic return does not match a concrete `impl`. It makes slice and vector Write for `u8` not match on every generic return value.
2023-03-09Rollup merge of #108929 - eltociear:patch-20, r=GuillaumeGomezMatthias Krüger-3/+3
Fix typo in span_map.rs correspondance -> correspondence
2023-03-09Rollup merge of #106915 - notriddle:notriddle/load-only-one-theme, ↵Matthias Krüger-2/+26
r=GuillaumeGomez,jsha Only load one CSS theme by default This is a tweaked version of #103971 that uses `document.write` to create the stylesheet link at startup, avoiding a FOUC during page navigation. It also rebases the PR, making it work with the new hashed filenames. Fixes #82614 Preview: http://notriddle.com/notriddle-rustdoc-demos/load-only-one-theme-v2/std/index.html
2023-03-09Fix typo in span_map.rsIkko Eltociear Ashimine-3/+3
correspondance -> correspondence
2023-03-08Rollup merge of #108686 - notriddle:notriddle/jank-all, r=jshaMatthias Krüger-3/+1
rustdoc: include link on all.html location header This avoids a subtle layout shift when switching from the crate page to all items. ## Before | index.html | all.html | |------------|----------| | ![image](https://user-images.githubusercontent.com/1593513/222607866-4eac3f55-314c-4273-9664-503f2a79ad0a.png) | ![image](https://user-images.githubusercontent.com/1593513/222607895-2d6bac3b-f66a-47d4-b234-360f6f8e1ee3.png) | ## After | index.html | all.html | |------------|----------| | ![image](https://user-images.githubusercontent.com/1593513/222607866-4eac3f55-314c-4273-9664-503f2a79ad0a.png) | ![image](https://user-images.githubusercontent.com/1593513/222607997-e72c48a0-02c7-42a7-80c2-cd6bed48bd15.png) |
2023-03-08Only load one CSS theme by defaultMichael Howell-2/+26
To avoid generating a FOUC at startup, this commit uses `document.write` to load the stylesheet initially. Co-Authored-By: Guillaume Gomez <guillaume1.gomez@gmail.com>
2023-03-07rustdoc: fix type search when more than one `where` clause appliesMichael Howell-1/+1
2023-03-07rustdoc: fix type search index for `fn<T>() -> &T where T: Trait`Michael Howell-1/+6
2023-03-04Rollup merge of #108734 - clubby789:rustdoc-layout-uninhabited, r=GuillaumeGomezMatthias Krüger-0/+6
rustdoc: Note in a type's layout/size if it is uninhabited Closes #87008 ![image](https://user-images.githubusercontent.com/13556931/222900244-8e326d51-8d3b-4700-a935-96830179e2e9.png)
2023-03-04rustdoc: include link on all.html location headerMichael Howell-3/+1
This avoids a subtle layout shift when switching from the crate page to all items.
2023-03-04rustdoc: function signature search with traits in `where` clauseMichael Howell-21/+13
2023-03-04rustdoc: Note in a type's layout/size if it is uninhabitedclubby789-0/+6
2023-02-19Rollup merge of #107783 - notriddle:notriddle/item-table-ul, r=GuillaumeGomezDylan DPC-10/+10
rustdoc: simplify DOM for `.item-table` This switches from using `<div>` to the more semantic `<ul>`, and using class names that rhyme with the classes the search results table uses.
2023-02-16remove bound_type_of query; make type_of return EarlyBinder; change type_of ↵Kyle Matsuda-1/+1
in metadata
2023-02-16change usages of type_of to bound_type_ofKyle Matsuda-1/+1
2023-02-15Rollup merge of #108076 - GuillaumeGomez:more-let-chain, r=notriddleMatthias Krüger-35/+31
rustdoc: Use more let chain Got the idea after yesterday's review. r? `@notriddle`
2023-02-15Use more let chainGuillaume Gomez-35/+31
2023-02-15Rollup merge of #107163 - mikebenfield:parameters-pr, r=TaKO8KiDylan DPC-2/+2
Remove some superfluous type parameters from layout.rs. Specifically remove V, which can always be VariantIdx, and F, which can always be Layout.
2023-02-13rustdoc: use a string with one-character codes for search index typesMichael Howell-1/+10
$ wc -c search-index.old.js search-index.new.js 3940530 search-index.old.js 3843222 search-index.new.js ((3940530-3843222)/3940530)*100 = 2.47% $ wc -c search-index.old.js.gz search-index.new.js.gz 380251 search-index.old.js.gz 379434 search-index.new.js.gz ((380251-379434)/380251)*100 = 0.214%
2023-02-13Rollup merge of #107340 - notriddle:notriddle/simplify-doctest-tooltip, ↵Matthias Krüger-1/+1
r=GuillaumeGomez rustdoc: merge doctest tooltip with notable traits tooltip Fixes https://discord.com/channels/442252698964721669/443150878111694848/1066420140167680000 <details><summary>a user report where the tooltip arrow overlaps the text</summary> ![](https://cdn.discordapp.com/attachments/443150878111694848/1066420139530145812/this-example-is-not-tested-busted-rendering.png) </details> Fixes #91100 Preview: <https://notriddle.com/notriddle-rustdoc-demos/simplify-doctest-tooltip/std/vec/struct.Vec.html#indexing> Screenshot: ![image](https://user-images.githubusercontent.com/1593513/214975516-72667632-4609-49fa-8c37-e8d2ba1ba7dc.png)
2023-02-12Rollup merge of #107934 - ↵Matthias Krüger-1/+4
notriddle:notriddle/intra-doc-link-meta-description, r=camelid,GuillaumeGomez rustdoc: account for intra-doc links in `<meta name="description">` Similar to #86451, but for the SEO descriptions instead of the search descriptions.
2023-02-11rustdoc: account for intra-doc links in `<meta name="description">`Michael Howell-1/+4
2023-02-11Rollup merge of #107864 - notriddle:notriddle/rustdoc-write-stutter, ↵Matthias Krüger-15/+12
r=GuillaumeGomez rustdoc: clean up `write!` calls with less stuttering
2023-02-11Rollup merge of #107490 - notriddle:notriddle/rm-sidebar-tooltip, ↵Dylan DPC-9/+3
r=GuillaumeGomez rustdoc: remove inconsistently-present sidebar tooltips Discussed in https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/Inconsistent.20sidebar.20tooltips/near/323565625
2023-02-10Rollup merge of #107852 - notriddle:notriddle/rm-tab, r=GuillaumeGomezMatthias Krüger-7/+5
rustdoc: remove unused fn parameter `tab`
2023-02-09rustdoc: clean up `write!` calls with less stutteringMichael Howell-15/+12
2023-02-09Rollup merge of #107655 - notriddle:notriddle/small-url-encode, r=GuillaumeGomezDylan DPC-23/+52
rustdoc: use the same URL escape rules for fragments as for examples Carries over improvements from #107284
2023-02-09rustdoc: remove unused fn parameter `tab`Michael Howell-7/+5
2023-02-07rustdoc: simplify DOM for `.item-table`Michael Howell-10/+10
This switches from using `<div>` to the more semantic `<ul>`, and using class names that rhyme with the classes the search results table uses.
2023-02-04rustdoc: trait bound formattingRoland Strasser-10/+10
rustdoc: fix item-spacer rustdoc: use proper comment style rustdoc: change formatting where clauses for traits rustdoc: remove semicolon from provided methods update provided methods formatting
2023-02-03rustdoc: use the same URL escape rules for fragments as for examplesMichael Howell-23/+52
2023-02-03Rollup merge of #107615 - notriddle:notriddle/nbsp, r=GuillaumeGomezMichael Goulet-2/+2
Replace nbsp in all rustdoc code blocks Based on #106125 by `@dtolnay` — this PR fixes the line wrapping bug. Fixes #106098. This makes code copyable from rustdoc rendered documentation into a Rust source file.
2023-02-03Replace nbsp in all rustdoc code blocksMichael Howell-2/+2
Co-Authored-By: David Tolnay <dtolnay@gmail.com>
2023-02-02Auto merge of #107000 - GuillaumeGomez:fix-items-in-doc-hidden-block, ↵bors-1/+1
r=notriddle,petrochenkov Fix handling of items inside a `doc(hidden)` block Fixes #106373. cc `@aDotInTheVoid` r? `@notriddle`
2023-01-31rustdoc: stop making unstable items transparentMichael Howell-14/+5
Fixes #93393