about summary refs log tree commit diff
path: root/src/librustdoc/html
AgeCommit message (Collapse)AuthorLines
2022-09-28rustdoc: add method spacing to trait methodsMichael Howell-2/+3
More cleanup for 8846c0853d8687fda0e5f23f6687b03b243980ee, this time in trait layouts when things are collapsed.
2022-09-28rustdoc: remove bad CSS font-weight on `.impl`, `.method`, etcMichael Howell-1/+0
This line was added in c494a06064017f307a8d9dc4797e614d2ed99143, because at the time, the headers had these classes on them. Now, the headers are children of the `<section>` with the class on it. This commit also adds a test case, to make sure the srclink font weight does not regress again.
2022-09-28rustdoc: clean up "normalize.css 8" input override CSSMichael Howell-13/+11
These rules were copied from normalize.css 3, and are mostly redundant. * `optgroup` isn't used in rustdoc at all * `textarea` is only used for the "copy" button, so it's not visible * The remaining buttons and inputs mostly have styles set anyway. * We should never be setting `color` without also setting the background to something. Otherwise, you get white-on-gray text. That seems to be [the reason] why `normalize.css` changed this. [the reason]: https://github.com/necolas/normalize.css/pull/502
2022-09-28Auto merge of #102384 - camelid:extrainfo, r=GuillaumeGomezbors-3/+8
rustdoc: Remove `clean::TraitWithExtraInfo` and queryify `is_notable_trait` cc `@notriddle` `@GuillaumeGomez`
2022-09-28rustdoc: cut margin-top from first header in docblockMichael Howell-0/+7
Fixes a regression caused by 8846c0853d8687fda0e5f23f6687b03b243980ee, where a header's top margin used to be collapsed, but isn't any more.
2022-09-28Auto merge of #102302 - nnethercote:more-lexer-improvements, r=matkladbors-3/+6
More lexer improvements A follow-up to #99884. r? `@matklad`
2022-09-28Rollup merge of #102380 - notriddle:notriddle/rustdoc-source-sidebar, r=camelidYuki Okushi-3/+0
rustdoc: remove redundant mobile `.source > .sidebar` CSS When the source sidebar and standard sidebar had most of their code merged in 07e3f998b1ceb4b8d2a7992782e60f5e776aa114, the properties `z-index: 11`, `margin: 0`, and `position: fixed` were already being set on the `.sidebar` class, so no need to repeat them. https://github.com/rust-lang/rust/blob/57ee5cf5a93923dae9c98bffb11545fc3a31368d/src/librustdoc/html/static/css/rustdoc.css#L1742-L1754
2022-09-28Address review comments.Nicholas Nethercote-1/+1
2022-09-27rustdoc: remove redundant mobile `.source > .sidebar` CSSMichael Howell-3/+0
When the source sidebar and standard sidebar had most of their code merged in 07e3f998b1ceb4b8d2a7992782e60f5e776aa114, the properties `z-index: 11`, `margin: 0`, and `position: fixed` were already being set on the `.sidebar` class, so no need to repeat them.
2022-09-27Rollup merge of #102369 - GuillaumeGomez:results-colors, r=notriddleMatthias Krüger-1/+3
Fix search result colors Fixes regression introduced in https://github.com/rust-lang/rust/commit/99c00714cff0d13b6c5092c9949cb4e93a121346. As you can see, ayu lost some colors for its search results: beta/nightly: ![Screenshot from 2022-09-27 19-46-49](https://user-images.githubusercontent.com/3050060/192606456-e7bb58dd-cf76-49a0-b1ae-28565adb1dc6.png) stable: ![Screenshot from 2022-09-27 19-46-36](https://user-images.githubusercontent.com/3050060/192606453-e720e219-a336-4ff1-989b-2fdb76e789eb.png) We'll need to backport it to beta too to prevent it reaching stable. r? `@notriddle`
2022-09-27Rollup merge of #102367 - notriddle:notriddle/help-text-align, r=GuillaumeGomezMatthias Krüger-5/+0
rustdoc: remove redundant `#help-button` CSS When the separate top and bottom styles were added in cd3f4da244578a2ab4d17d10016c61b9191b21e4, some of the CSS rules were needlessly duplicated. The `text-align: initial` rule on `.side-by-side` was always redundant, since the rules that centered the text were set on children, not parents.
2022-09-27Rollup merge of #102330 - notriddle:notriddle/srclink, r=GuillaumeGomezMatthias Krüger-7/+0
rustdoc: remove no-op CSS `.srclink { font-weight; font-size }` When this CSS was added in 34bd2b845b3acd84c5a9bddae3ff8081c19ec5e9, source links were nested below headers. https://github.com/rust-lang/rust/blob/34bd2b845b3acd84c5a9bddae3ff8081c19ec5e9/src/librustdoc/html/render.rs#L4015-L4019 Now, thanks to 458e7219bc2a62f72368279945cfda632a016da1, they are now siblings of headers, and thanks to 270d09dca9aae263671c4d32bbc7cb60dc378af8, they have the same font size that they would've had anyway.
2022-09-27rustdoc: remove `clean::TraitWithExtraInfo`Michael Howell-3/+8
Instead, it gathers the extra info later, when it's actually requested.
2022-09-27Fix regression for results colorsGuillaume Gomez-1/+3
2022-09-27rustdoc: remove redundant `#help-button` CSSMichael Howell-5/+0
When the separate top and bottom styles were added in cd3f4da244578a2ab4d17d10016c61b9191b21e4, some of the CSS rules were needlessly duplicated. The `text-align: initial` rule on `.side-by-side` was always redundant, since the rules that centered the text were set on children, not parents.
2022-09-27rustdoc: use CSS containment to speed up renderJacob Hoffman-Andrews-13/+29
https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Containment This affected layout a little and required adjustments to the CSS to keep spacing the same. In particular, the margins of adjacent items usually overlap with each other. However, when an item has contain: layout, any margins of child nodes push out the size of the item itself. This was making spacing between items a little too big. To solve that, I removed margins in some places: in particular for certain classes that often occur at the end of a `details.rustdoc-toggle` block, I removed their bottom margin. Generally, the margins provided by the next item down are sufficient. Also remove an unnecessary margin-top on .code-header.
2022-09-26Rollup merge of #102325 - notriddle:notriddle/line-number, r=GuillaumeGomezMichael Howell-28/+28
rustdoc: give `.line-number` / `.line-numbers` meaningful names
2022-09-26rustdoc: remove no-op CSS `.srclink { font-weight; font-size }`Michael Howell-7/+0
When this CSS was added in 34bd2b845b3acd84c5a9bddae3ff8081c19ec5e9, source links were nested below headers. https://github.com/rust-lang/rust/blob/34bd2b845b3acd84c5a9bddae3ff8081c19ec5e9/src/librustdoc/html/render.rs#L4015-L4019 Now, thanks to 458e7219bc2a62f72368279945cfda632a016da1, they are now siblings of headers, and thanks to 270d09dca9aae263671c4d32bbc7cb60dc378af8, they have the same font size that they would've had anyway.
2022-09-26rustdoc: simplify example-line-numbers CSS selectorMichael Howell-4/+4
2022-09-26rustdoc: give `.line-number` / `.line-numbers` meaningful namesMichael Howell-28/+28
2022-09-26rustdoc: merge `table { border-collapse } into `.docblock table`Michael Howell-4/+1
This was added in 510107815fe888319028c5e96001cdee70e7a931, to fix the display of the module items and search results tables (see the discussion in https://github.com/rust-lang/rust/pull/86725). Those aren't tables any more. The only remaining table is in docblock, which needs this attribute to look right.
2022-09-26rustdoc: remove unneeded CSS `td, th { padding 0 }`Michael Howell-5/+0
This was added in 510107815fe888319028c5e96001cdee70e7a931, to fix the display of the module items and search results tables (see the discussion in https://github.com/rust-lang/rust/pull/86725). Those aren't tables any more. The only remaining table is in docblock, which has its own padding declarations.
2022-09-26Add `rustc_lexer::TokenKind::Eof`.Nicholas Nethercote-1/+5
For alignment with `rust_ast::TokenKind::Eof`. Plus it's a bit faster, due to less `Option` manipulation in `StringReader::next_token`.
2022-09-26Make `rustc_lexer::cursor::Cursor` public.Nicholas Nethercote-5/+4
`Cursor` is currently hidden, and the main tokenization path uses `rustc_lexer::first_token` which involves constructing a new `Cursor` for every single token, which is weird. Also, `first_token` also can't handle empty input, so callers have to check for that first. This commit makes `Cursor` public, so `StringReader` can contain a `Cursor`, which results in a simpler structure. The commit also changes `StringReader::advance_token` so it returns an `Option<Token>`, simplifying the the empty input case.
2022-09-25rustdoc: clean up `.out-of-band`/`.in-band` CSSMichael Howell-14/+8
* Remove the `float: right` fallback from the main header, which hasn't been needed since IE11 support was dropped. * Remove `in-band` from low-level headers, which hasn't been needed since `.rightside` switched to `float: right` in 593d6d1cb15c55c88319470dabb40126c7b7f1e2 * Remove unreachable `.in-band > code, .in-band > .code-header` CSS, since the `in-band` class was attached to the `code-header` itself, not nested directly below it. * Use `rem` instead of `em` for code header margins. * This results in a slight change in spacing around impls and item-info, but since it makes it more consistent with the way methods are presented, it's probably fine.
2022-09-25Rollup merge of #102242 - notriddle:notriddle/summary, r=GuillaumeGomezMatthias Krüger-4/+0
rustdoc: remove unused CSS `.summary` It was added in 4d16de01d0beb84dc4a351022ea5cb587b4ab557 as part of a stability dashboard that was removed in 0a46933c4d81573e78ce16cd215ba155a3114fce.
2022-09-24rustdoc: remove unused CSS `.summary`Michael Howell-4/+0
It was added in 4d16de01d0beb84dc4a351022ea5cb587b4ab557 as part of a stability dashboard that was removed in 0a46933c4d81573e78ce16cd215ba155a3114fce.
2022-09-24rustdoc: remove unused CSS `#main-content > .line-numbers`Michael Howell-4/+0
This selector was added in 10b937028660e079cf15735cfb5c4d58892fb10e. It became unreachable when 09150f81930e035254e58ee56f5905c2eb421617 made it so that `.line-numbers` are always nested below `.example-wrap`, even on source pages.
2022-09-24Rollup merge of #102203 - notriddle:notriddle/source-sidebar, r=GuillaumeGomezMatthias Krüger-5/+0
rustdoc: remove no-op CSS `#source-sidebar { z-index }` This rule became redundant in 07e3f998b1ceb4b8d2a7992782e60f5e776aa114. When `#source-sidebar` became nested below `.sidebar`, it went from being `position: fixed` to `position: static`, and according to MDN's [z-index] documentation, this means it has no effect. [z-index]: https://developer.mozilla.org/en-US/docs/Web/CSS/z-index
2022-09-24Rollup merge of #102146 - notriddle:notriddle/sidebar-jank, r=GuillaumeGomezMatthias Krüger-1/+1
rustdoc: CSS prevent sidebar width change jank This commit makes the `width` and `min-width` of the sidebar the same. They originally were when cad0fce2053d52b7ba04c458f4c124c8b5c6141e added the `min-width` rule, but 6a5f8b1aef1417d7dc85b5d0a229d2db1930eb7c changed the `width` without changing the `min-width`, causing it to sometimes oscilate between 200 and 250 pixels depending on the main content. # Before [Screencast from 09-22-2022 10:25:29 AM.webm](https://user-images.githubusercontent.com/1593513/191813469-ea00f30f-6f49-40fc-9a26-e1dfd5068d2b.webm) # After [Screencast from 09-22-2022 10:32:20 AM.webm](https://user-images.githubusercontent.com/1593513/191813642-ae0902da-5262-403a-bbdf-995334201acb.webm)
2022-09-23rustdoc: remove no-op CSS rule `#source-sidebar { z-index: 1 }`Michael Howell-1/+0
This rule became redundant in 07e3f998b1ceb4b8d2a7992782e60f5e776aa114. When `#source-sidebar` became nested below `.sidebar`, it went from being `position: fixed` to `position: static`, and according to MDN's [z-index] documentation, this means it has no effect. [z-index]: https://developer.mozilla.org/en-US/docs/Web/CSS/z-index
2022-09-23rustdoc: remove no-op mobile CSS `#source-sidebar { z-index: 11 }`Michael Howell-4/+0
This rule became redundant in 07e3f998b1ceb4b8d2a7992782e60f5e776aa114. When `#source-sidebar` became nested below `.sidebar`, it went from being `position: fixed` to `position: static`, and according to MDN's [z-index] documentation, this means it has no effect. [z-index]: https://developer.mozilla.org/en-US/docs/Web/CSS/z-index
2022-09-23rustdoc: CSS prevent sidebar width change jankMichael Howell-1/+1
This commit makes the `width` and `min-width` of the sidebar the same. They originally were when cad0fce2053d52b7ba04c458f4c124c8b5c6141e added the `min-width` rule, but 6a5f8b1aef1417d7dc85b5d0a229d2db1930eb7c changed the width without changing the `min-width`, causing it to sometimes oscilate between 200 and 250 pixels depending on the main content.
2022-09-23Rollup merge of #102158 - notriddle:notriddle/stab-p, r=GuillaumeGomezMatthias Krüger-30/+17
rustdoc: clean up CSS/DOM for deprecation warnings Preview: https://notriddle.com/notriddle-rustdoc-test/stab-p/std/macro.try.html
2022-09-23Auto merge of #102165 - matthiaskrgr:rollup-n5oquhe, r=matthiaskrgrbors-1/+0
Rollup of 8 pull requests Successful merges: - #100734 (Split out async_fn_in_trait into a separate feature) - #101664 (Note if mismatched types have a similar name) - #101815 (Migrated the rustc_passes annotation without effect diagnostic infrastructure) - #102042 (Distribute rust-docs-json via rustup.) - #102066 (rustdoc: remove unnecessary `max-width` on headers) - #102095 (Deduplicate two functions that would soon have been three) - #102104 (Set 'exec-env:RUST_BACKTRACE=0' in const-eval-select tests) - #102112 (Allow full relro on powerpc64-unknown-linux-gnu) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-09-23Rollup merge of #102066 - notriddle:notriddle/headers-max-width, ↵Matthias Krüger-1/+0
r=GuillaumeGomez rustdoc: remove unnecessary `max-width` on headers This code was added in 003b2bc1c65251ec2fc80b78ed91c43fb35402ec to prevent these headers from overlapping `.out-of-band` side items. That stopped being a problem when 3f92ff34b5a2fe8dd1a32aa27d437519e63782f0 switched rustdoc over to using `float`, rather than `position: absolute`, to implement this.
2022-09-22rustdoc: fix unit testsMichael Howell-6/+5
2022-09-22rustdoc: clean up CSS/DOM for deprecation warningsMichael Howell-24/+12
2022-09-22Rollup merge of #102147 - notriddle:notriddle/location-border-none, ↵Matthias Krüger-4/+0
r=GuillaumeGomez rustdoc: remove no-op CSS `.location:empty { border: none }` This rule was added in 2bb2a2975f25e8ba7a372898e7e112f1cec5db01 to remove a border placed around the location when it's empty. That rule was removed in 6a5f8b1aef1417d7dc85b5d0a229d2db1930eb7c, so this rule does nothing.
2022-09-22Rollup merge of #102135 - GuillaumeGomez:rename-alltypes-fields, r=notriddleMatthias Krüger-10/+12
Improve some AllTypes fields name r? `@notriddle`
2022-09-22Rollup merge of #102125 - notriddle:notriddle/content-item-info, ↵Matthias Krüger-1/+0
r=GuillaumeGomez rustdoc: remove no-op CSS `.content .item-info { position: relative }` This rule was added to help position the marker line in 110e7270ab7b0700ce714b8b1c7e509195dea2c4, which was a `position: absolute` pseudo-element that relied on its parent to put it in the right spot. (it was changed from a line to an arrow in 1ffb9cf8d75e6f8b9aa27a25c7bc56c7bb3a1c43, then a different arrow in ae3a53ff58cec7aca1dfd17479fca44b7f91491f). The arrow was removed in 73d0f7c7b68784f1db0a1f53855c20d118a7e8b0, so the `relative` position is no longer necessary.
2022-09-22Rollup merge of #102118 - notriddle:notriddle/line-numbers, r=GuillaumeGomezMatthias Krüger-16/+38
rustdoc: clean up line numbers on code examples * First commit switches from `display: inline-flex; width: 100%` to `display: flex`. `display: inline-flex` was used as part of https://github.com/rust-lang/rust/commit/e961d397cab900c55f8d8c104648852e2b63664e, the original commit that added these line numbers. Does anyone know why it was done this way? * Second commit makes it so that toggling this checkbox will update the page in real time, just like changing themes does. Preview: https://notriddle.com/notriddle-rustdoc-test/line-numbers/std/vec/struct.Vec.html
2022-09-22rustdoc: remove no-op CSS `.location:empty { border: none }`Michael Howell-4/+0
This rule was added in 2bb2a2975f25e8ba7a372898e7e112f1cec5db01 to remove a border placed around the location when it's empty. That rule was removed in 6a5f8b1aef1417d7dc85b5d0a229d2db1930eb7c, so this rule does nothing.
2022-09-22Rollup merge of #102107 - Urgau:rustdoc-missing-space-before-where-clause, ↵Dylan DPC-1/+1
r=GuillaumeGomez Add missing space between notable trait tooltip and where clause This PR add a missing space between the notable trait tooltip and the where clause. The issue can be seeing on the [BufRead](https://doc.rust-lang.org/nightly/std/io/trait.BufRead.html) page. Added a simple snapshot regression test in `src/test/rustdoc/where.rs`. Before: ![image](https://user-images.githubusercontent.com/3616612/191566999-2f80e138-29c9-4f66-8bed-07781cbd9783.png) After: ![image](https://user-images.githubusercontent.com/3616612/191567025-0ed3f7d4-7cec-4788-901f-5980fc241daa.png) r? `@GuillaumeGomez`
2022-09-22Improve some AllTypes fields nameGuillaume Gomez-10/+12
2022-09-21rustdoc: remove no-op CSS `.content .item-info { position: relative }`Michael Howell-1/+0
This rule was added to help position the marker line in 110e7270ab7b0700ce714b8b1c7e509195dea2c4, which was a `position: absolute` pseudo-element that relied on its parent to put it in the right spot. The arrow was removed in 73d0f7c7b68784f1db0a1f53855c20d118a7e8b0, so the `relative` position is no longer necessary.
2022-09-21rustdoc: remove unnecessary `max-width` on headersMichael Howell-1/+0
This code was added in 003b2bc1c65251ec2fc80b78ed91c43fb35402ec to prevent these headers from overlapping `.out-of-band` side items. That stopped being a problem when 3f92ff34b5a2fe8dd1a32aa27d437519e63782f0 switched rustdoc over to using `float`, rather than `position: absolute`, to implement this.
2022-09-22Rollup merge of #102100 - GuillaumeGomez:stab-in-docblocks, r=notriddleYuki Okushi-0/+6
Prevent usage of .stab elements to create scrollable areas in doc blocks Fixes #101874. You can test it online [here](https://rustdoc.crud.net/imperio/stab-in-doblocks/foo/index.html). r? `@notriddle`
2022-09-22Rollup merge of #102075 - notriddle:notriddle/content-methods-method, ↵Yuki Okushi-4/+0
r=GuillaumeGomez rustdoc: remove no-op CSS `.content > .methods > .method` # `font-size: 1rem` This rule was added in 22dad4b0440b184568956c10f2cbedabf763065a, back when the `method` class was attached to headers instead of DIVs that wrap headers. Old method rendering: https://github.com/rust-lang/rust/blob/a96247bcac385671757034bd928c13097fd2ce76/src/librustdoc/html/render.rs#L2062 Current method rendering: https://github.com/rust-lang/rust/blob/432abd86f231c908f6df3cdd779e83f35084be90/src/librustdoc/html/render/print_item.rs#L721 # `position: relative` This rule was added in 88fe6dfa31a1bee49090dc72c537c5cd7bd632f4 to assist in position the hide/show togges on methods. This is no longer needed, because these toggles are no longer implemented as absolutely positioned links nested inside headers.
2022-09-22Rollup merge of #102054 - GuillaumeGomez:sidebar-all-page, r=notriddleYuki Okushi-44/+104
Unify "all items" page's sidebar with other pages Currently, the "all types" page's sidebar doesn't list the different categories of type available. This PR fixes it. Before: ![Screenshot from 2022-09-20 17-11-15](https://user-images.githubusercontent.com/3050060/191296348-95d8771d-a887-432e-96bd-d5284d87d743.png) After: ![Screenshot from 2022-09-20 17-11-09](https://user-images.githubusercontent.com/3050060/191296344-8e7318a3-eb51-4037-ae94-7ae2115363ce.png) r? `@notriddle`