about summary refs log tree commit diff
path: root/src/librustdoc/html
AgeCommit message (Collapse)AuthorLines
2023-04-13rustdoc-search: use ES6 `Set` for deduplication instead of `Object`Michael Howell-3/+3
2023-04-13rustdoc-search: use ES6 `Map` for generic matching instead of `Object`Michael Howell-23/+14
2023-04-13rustdoc-search: use ES6 `Map` for aliases instead of `Object`Michael Howell-11/+16
2023-04-12Auto merge of #110252 - matthiaskrgr:rollup-ovaixra, r=matthiaskrgrbors-1/+1
Rollup of 8 pull requests Successful merges: - #109810 (Replace rustdoc-ui/{c,z}-help tests with a stable run-make test ) - #110035 (fix: ensure bad `#[test]` invocs retain correct AST) - #110089 (sync::mpsc: synchronize receiver disconnect with initialization) - #110103 (Report overflows gracefully with new solver) - #110122 (Fix x check --stage 1 when download-ci-llvm=false) - #110133 (Do not use ImplDerivedObligationCause for inherent impl method error reporting) - #110135 (Revert "Don't recover lifetimes/labels containing emojis as character literals") - #110235 (Fix `--extend-css` option) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-04-12Rollup merge of #110205 - notriddle:notriddle/pixelated-border, r=GuillaumeGomezMatthias Krüger-1/+5
rustdoc: make settings radio and checks thicker, less contrast This is very dependent on subjectivity and what screen you use, but this change makes the radio buttons' outer circle less ugly. This is because I could see the pixels very clearly, thanks to the very thin line and high contrast. This change makes both less severe, giving your browser's antialiasing algorithm more to work with. Since it's thicker, lowering the contrast shouldn't impact visibility. ## Preview https://notriddle.com/rustdoc-demo-html-3/pixelated-border/settings.html ## Before ![image](https://user-images.githubusercontent.com/1593513/231274191-143acbea-c433-4fb1-b46d-e5e4fe328d60.png) ## After ![image](https://user-images.githubusercontent.com/1593513/231287415-c1e59fe8-8bf8-489d-b607-95ebb71e4ac5.png) <details><summary>Original "after" image with 2px border around checked box</summary> ![image](https://user-images.githubusercontent.com/1593513/231274253-8b5011c6-82fb-4396-84d0-47b6bdff2260.png) </details>
2023-04-12Move creation of `theme.css` file from `--extend-css` command into the ↵Guillaume Gomez-1/+1
`static.files` folder
2023-04-12rustdoc: use CSS `overscroll-behavior` instead of JavaScriptMichael Howell-56/+8
Fixes the desktop scrolling weirdness mentioned in https://github.com/rust-lang/rust/pull/98775#issuecomment-1182575603 As described in the MDN page for this property: * The current Firefox ESR is 102, and the first Firefox version to support this feature is 59. * The current Chrome version 112, and the first version to support this is 63. * Edge is described as having a minor bug in `none` mode, but we use `contain` mode anyway, so it doesn't matter. * Safari 16, released September 2022, is the last browser to add this feature, and is also the oldest version we officially support.
2023-04-12remove some unneeded importsKaDiWa-3/+1
2023-04-12rustdoc: make settings radio and checks thicker, less contrastMichael Howell-1/+5
This is very dependent on subjectivity and what screen you use, but this change makes the radio buttons' outer circle less ugly. This is because I could see the pixels very clearly, thanks to the very thin line and high contrast. This change makes both less severe, giving your browser's antialiasing algorithm more to work with. Since it's thicker, lowering the contrast shouldn't impact visibility.
2023-04-11Rollup merge of #110162 - notriddle:notriddle/main-js-expand, r=GuillaumeGomezMichael Goulet-14/+5
rustdoc: remove redundant expandSection code from main.js This functionality is already tested in `hash-item-expansion.goml`, and was implemented twice: * First, in code that ran at load time and at hash change: 917cdd295d2eed213c135d6f984c650f016ee3d6 * Later, the hash change event handler was itself run at load time, and the code handling both cases diverged in implementation, though their behavior still matches pretty well: f66a331335f3ac931afabca6f927a9d7dc17db3e
2023-04-10rustdoc: remove redundant expandSection code from main.jsMichael Howell-14/+5
This functionality is already tested in `hash-item-expansion.goml`, and was implemented twice: * First, in code that ran at load time and at hash change: 917cdd295d2eed213c135d6f984c650f016ee3d6 * Later, the hash change event handler was itself run at load time, and the code handling both cases diverged in implementation, though their behavior still matches pretty well: f66a331335f3ac931afabca6f927a9d7dc17db3e
2023-04-10Fix typos in librustdocDaniPopes-4/+5
2023-04-08rustdoc: migrate `document_type_layout` to askamaMichael Howell-99/+112
2023-04-08Auto merge of #109925 - notriddle:notriddle/item-union, r=GuillaumeGomezbors-476/+595
rustdoc: migrate item_union to an Askama template
2023-04-08Rollup merge of #110037 - notriddle:notriddle/theme-default, r=GuillaumeGomezNilstrieb-0/+1
rustdoc: add test and bug fix for theme defaults Part of https://github.com/rust-lang/rust/issues/66181
2023-04-06rustdoc: add test and bug fix for theme defaultsMichael Howell-0/+1
2023-04-06rustdoc: clean up JSMichael Howell-28/+9
* Stop checking `func` in `onEach`. It's always hard-coded right at the call site, so there's no point. * Use the ternary operator in a few spots where it makes sense. * No point in making `onEach` store `arr.length` in a variable if it's only used once anyway.
2023-04-06Rollup merge of #109977 - notriddle:notriddle/data-nosnippet, r=jsha,the8472Matthias Krüger-9/+11
rustdoc: avoid including line numbers in Google SERP snippets ![image](https://user-images.githubusercontent.com/1593513/230141184-9171c8e0-de92-48e6-85b6-8baee35e6d86.png)
2023-04-05rustdoc: avoid including line numbers in Google SERP snippetsMichael Howell-9/+11
2023-04-06Rollup merge of #109973 - GuillaumeGomez:logo-display-very-small-screen, ↵Yuki Okushi-1/+6
r=notriddle rustdoc: Improve logo display very small screen Before: ![Screenshot from 2023-04-05 16-56-33](https://user-images.githubusercontent.com/3050060/230125438-c63c8de1-923c-4534-adf1-bdef02e402a9.png) After: ![Screenshot from 2023-04-05 16-57-17](https://user-images.githubusercontent.com/3050060/230125467-d3d46878-373a-4f8a-8554-1bb8c4baf46d.png) r? `@notriddle`
2023-04-05Improve display of logo on very small screensGuillaume Gomez-1/+6
2023-04-05rustdoc: migrate `item_union` to an Askama templateMichael Howell-293/+384
2023-04-05Rollup merge of #109932 - GuillaumeGomez:source-code-scrollbar, r=notriddleYuki Okushi-0/+4
Source code scrollbar Fixes https://github.com/rust-lang/rust/issues/109865. You can test it [here](https://rustdoc.crud.net/imperio/source-code-scrollbar/src/test_docs/lib.rs.html). It seems to introduce a few regressions (at least change of behaviour) about the scroll "saving" though. r? `@notriddle`
2023-04-04Rollup merge of #109919 - fmease:rustdoc-fix-issue-109488, r=notriddleMichael Goulet-16/+15
rustdoc: escape GAT args in more cases Fixes #109488. Previously we printed the *un*escaped form of GAT arguments not only when `f.alternate()` was true but *also* when we failed to compute the URL of the trait associated with the type projection, i.e. when `href(…)` returned an `Err(_)`. In this PR the argument printing logic is entirely separate from the link resolution code above as it should be. Further, we now only try to compute the URL if the HTML format was requested with `!f.alternate()`. Before, we would sometimes compute the `href` only to throw it away later.
2023-04-04Move scrollbar on the <main> element rather than only on the code block to ↵Guillaume Gomez-0/+4
improve UX
2023-04-03rustdoc: migrate document functions to return a DisplayMichael Howell-150/+169
2023-04-04rustdoc: escape GAT args in more casesLeón Orell Valerian Liehr-16/+15
2023-04-03rustdoc: convert render_attributes_in_pre to return a DisplayMichael Howell-20/+27
2023-04-03rustdoc: convert `print_tuple_struct_fields` to return a DisplayMichael Howell-16/+18
2023-04-01a couple clippy::complexity fixesMatthias Krüger-7/+4
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-31rustdoc-search: update docs for comma in `?` help popoverMichael Howell-3/+1
2023-03-28rustdoc + rustdoc-json support for non_lifetime_bindersMichael Goulet-2/+2
2023-03-27Rollup merge of #109633 - GuillaumeGomez:fix-go-to-only-setting, r=notriddleMatthias Krüger-5/+1
Fix "Directly go to item in search if there is only one result" setting Part of #66181. The setting was actually broken, so I fixed it when I added the GUI test. r? `@notriddle`
2023-03-26Fix "Directly go to item in search if there is only one result" settingGuillaume Gomez-5/+1
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-25Rollup merge of #109542 - notriddle:notriddle/storage-js, r=GuillaumeGomezMatthias Krüger-77/+19
rustdoc: clean up `storage.js`
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-24Rollup merge of #108629 - notriddle:notriddle/item-type-advanced, ↵Matthias Krüger-53/+111
r=GuillaumeGomez rustdoc: add support for type filters in arguments and generics This makes sense, since the search index has the information in it, and it's more useful for function signature searches since a function signature search's item type is, by definition, some type of function (there's more than one, but not very many).
2023-03-23rustdoc: remove old `content` hack for theme switchingMichael Howell-47/+5
This is based on the compatibility data for `window.matchMedia` and `MediaQueryList`'s `EventTarget` implementation. https://developer.mozilla.org/en-US/docs/Web/API/MediaQueryList#browser_compatibility https://developer.mozilla.org/en-US/docs/Web/API/Window/matchMedia#browser_compatibility * EventTarget would require us to drop support for all Chrome versions before 39. However, we already require Chrome 49, because rustdoc requires [CSS variables]. * EventTarget would also limit us to Firefox 55, but since #106502 rustdoc only supports Firefox > 68. * EventTarget limits us to Mobile Safari version 14, but #102404 shows that our CSS is broken in Safari versions before 15.5. [CSS variables]: https://developer.mozilla.org/en-US/docs/Web/CSS/--*#browser_compatibility
2023-03-23rustdoc: clean up `storage.js`Michael Howell-30/+14
This converts a few functions to more compact versions of themselves, and moves `RUSTDOC_MOBILE_BREAKPOINT` to main.js where it's actually used.
2023-03-23Auto merge of #109503 - matthiaskrgr:rollup-cnp7kdd, r=matthiaskrgrbors-2/+2
Rollup of 9 pull requests Successful merges: - #108954 (rustdoc: handle generics better when matching notable traits) - #109203 (refactor/feat: refactor identifier parsing a bit) - #109213 (Eagerly intern and check CrateNum/StableCrateId collisions) - #109358 (rustc: Remove unused `Session` argument from some attribute functions) - #109359 (Update stdarch) - #109378 (Remove Ty::is_region_ptr) - #109423 (Use region-erased self type during IAT selection) - #109447 (new solver cleanup + implement coherence) - #109501 (make link clickable) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
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-22Auto merge of #109497 - matthiaskrgr:rollup-6txuxm0, r=matthiaskrgrbors-21/+21
Rollup of 10 pull requests Successful merges: - #109373 (Set LLVM `LLVM_UNREACHABLE_OPTIMIZE` to `OFF`) - #109392 (Custom MIR: Allow optional RET type annotation) - #109394 (adapt tests/codegen/vec-shrink-panik for LLVM 17) - #109412 (rustdoc: Add GUI test for "Auto-hide item contents for large items" setting) - #109452 (Ignore the vendor directory for tidy tests.) - #109457 (Remove comment about reusing rib allocations) - #109461 (rustdoc: remove redundant `.content` prefix from span/a colors) - #109477 (`HirId` to `LocalDefId` cleanup) - #109489 (More general captures) - #109494 (Do not feed param_env for RPITITs impl side) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-03-23Rollup merge of #109187 - clubby789:askama-source, r=GuillaumeGomezDylan DPC-69/+67
Render source page layout with Askama ~~I was looking at making `code_html` render into the buffer instead of in advance, but it turned out to need a pretty big refactor, so starting with rearranging the high-level layout.~~ Found another approach which required much less changes cc #108868
2023-03-21rustdoc: remove redundant `.content` prefix from span/a colorsMichael Howell-21/+21
Reverts a1d4ebe4961c107272f9764d1908227a3cd04092, as well as fixing the problem it solved with links losing their color.
2023-03-21Add `safe` to number renderingclubby789-2/+2
2023-03-20rustdoc: add support for type filters in arguments and genericsMichael Howell-53/+111
This makes sense, since the search index has the information in it, and it's more useful for function signature searches since a function signature search's item type is, by definition, some type of function (there's more than one, but not very many).
2023-03-20rustdoc: Optimize impl sorting during renderingVadim Petrochenkov-7/+20
2023-03-20Rollup merge of #109375 - clubby789:unescape-deprecated-doc, r=jshaMatthias Krüger-1/+1
rustdoc: Fix improper escaping of deprecation reasons Fix #109374 r? `@jsha`
2023-03-20Rollup merge of #109351 - GuillaumeGomez:no-footnote-in-summary, r=notriddleMatthias Krüger-1/+13
rustdoc: Remove footnote references from doc summary Since it's one line, we don't have the footnote definition so it doesn't make sense to have the reference. Part of https://github.com/rust-lang/rust/issues/109024. r? `@notriddle`