about summary refs log tree commit diff
path: root/src/librustdoc/html
AgeCommit message (Collapse)AuthorLines
2022-10-08Rollup merge of #102815 - notriddle:notriddle/mobile-topbar, r=GuillaumeGomezMatthias Krüger-10/+10
rustdoc: remove mobile topbar from source pages instead of hiding it
2022-10-08Clean up rustdoc highlight.rs imports a bitGuillaume Gomez-4/+2
2022-10-08rustdoc: remove weird `<a href="#">` wrapper around unsafe triangleMichael Howell-1/+1
This DOM cleanup changes the color of the triangle, from blue to black, but since it's still a different color from the link it's next to, it should still be noticeable.
2022-10-08rustdoc: remove mobile topbar from source pages instead of hiding itMichael Howell-10/+10
2022-10-08Rollup merge of #102798 - notriddle:notriddle/text-decoration-underline, ↵Matthias Krüger-7/+2
r=GuillaumeGomez rustdoc: add main-heading and example-wrap link CSS to big selector This makes the stylesheet more consistent about how it handles link hover.
2022-10-07rustdoc: add main-heading and example-wrap link CSS to big selectorMichael Howell-7/+2
This makes the stylesheet more consistent about how it handles link hover.
2022-10-07rustdoc: remove no-op CSS `.rightside { position: initial }`Michael Howell-1/+0
This CSS, added in 34bd2b845b3acd84c5a9bddae3ff8081c19ec5e9, overrode CSS that was applied to the `.since` class: https://github.com/rust-lang/rust/blob/34bd2b845b3acd84c5a9bddae3ff8081c19ec5e9/src/librustdoc/html/static/rustdoc.css#L782-L795 The absolute positioning for `.since` was abandoned in favor of always floating it, so this is no longer needed: https://github.com/rust-lang/rust/commit/5de1391b88007a1d4f7b1517657a86aae352af1e#diff-7dc22a0530802d77c2f2ec9e834024a5657b6eab4055520fca46edc99a544413L902-L904
2022-10-08rustdoc: remove hover gap in file pickerRoland Strasser-1/+17
2022-10-07Rollup merge of #102747 - notriddle:notriddle/docblock-a-not-srclink, ↵Matthias Krüger-2/+3
r=GuillaumeGomez rustdoc: remove unused CSS `.docblock a:not(.srclink)` This selector was added in c7312fbae4979c6d4fdfbd1f55a71cd47d82a480, because the list of impl items could be nested below `docblock`. https://github.com/rust-lang/rust/blob/c7312fbae4979c6d4fdfbd1f55a71cd47d82a480/src/librustdoc/html/render.rs#L3841-L3845 Now that rustdoc toggles have been switched to `<details>`, there shouldn't be any need to put things inside docblock containers just to give them disclosure toggles.
2022-10-07Rollup merge of #102744 - notriddle:notriddle/content-item-list, ↵Matthias Krüger-9/+4
r=GuillaumeGomez rustdoc: remove unused CSS `.content .item-list` When these rules were added in 4fd061c426902b0904c65e64a3780b21f9ab3afb (yeah, that's the very first commit of rustdoc_ng), `.item-list` was a `<ul>`, and this would override the default style for that tag. In c1b1d6804bfce1aee3a95b3cbff3eaeb15bad9a4, it was changed to use a `<div>` tag, so these rules are both no-ops.
2022-10-06rustdoc: remove unused CSS `.docblock a:not(.srclink)`Michael Howell-2/+3
This selector was added in c7312fbae4979c6d4fdfbd1f55a71cd47d82a480, because the list of impl items could be nested below `docblock`. https://github.com/rust-lang/rust/blob/c7312fbae4979c6d4fdfbd1f55a71cd47d82a480/src/librustdoc/html/render.rs#L3841-L3845 Now that rustdoc toggles have been switched to `<details>`, there shouldn't be any need to put things inside docblock containers just to give them disclosure toggles.
2022-10-06rustdoc: remove unused HTML `class="item-list"`Michael Howell-4/+4
Since 50f662e99ec372a3c9558876d4164e8665859217, there is no CSS or JS targeting this class.
2022-10-06rustdoc: remove unused CSS `.content .item-list`Michael Howell-5/+0
When these rules were added in 4fd061c426902b0904c65e64a3780b21f9ab3afb (yeah, that's the very first commit of rustdoc_ng), `.item-list` was a `<ul>`, and this would override the default style for that tag. In c1b1d6804bfce1aee3a95b3cbff3eaeb15bad9a4, it was changed to use a `<div>` tag, so these rules are both no-ops.
2022-10-06Rollup merge of #102736 - GuillaumeGomez:search-input-color, r=notriddleMatthias Krüger-8/+4
Migrate search input color to CSS variable Part of https://github.com/rust-lang/rust/pull/98460. No UI changes. r? `@notriddle`
2022-10-06Migrate search input color to CSS variableGuillaume Gomez-8/+4
2022-10-06Auto merge of #102707 - ↵bors-1/+2
fmease:rustdoc-render-more-cross-crate-hrtbs-properly, r=GuillaumeGomez rustdoc: render more cross-crate HRTBs properly Follow-up to #102439. Render the `for<>` parameter lists of cross-crate higher-rank trait bounds (in where-clauses and in `impl Trait`). I've added a new field `bound_params` to `clean::WherePredicate::EqPredicate` (mirroring its sibling variant `BoundPredicate`). However, I had to box the existing fields since `EqPredicate` used to be the largest variant (128 bytes on 64-bit systems) and it would only have gotten bigger). Not sure if you like that approach. As an alternative, I could pass the uncleaned `ty::Predicate` alongside the cleaned `WherePredicate` to the various re-sugaring methods (similar to what `clean::AutoTraitFinder::param_env_to_generics` does). I haven't yet added the HTML & JSON rendering code for the newly added `bound_params` field since I am waiting for your opinion. Those two rendering code paths should actually be unreachable in practice given we re-sugar all(?) equality predicates to associated type bindings (and arbitrary equality predicates are not part of the Rust surface language at the time of this writing). If you agree with storing `bound_params` in `EqPredicate`, I think I can use it to greatly simplify the `clean::auto_trait` module (by also using `simplify::merge_bounds`). Maybe I can do that in any case though. `@rustbot` label T-rustdoc A-cross-crate-reexports r? `@GuillaumeGomez`
2022-10-05rustdoc: remove unused CSS class `in-band`Michael Howell-43/+25
Since a7c25b29575c17434406b69773f8c2961af343b3 removed `in-band` from code headers, the only remaining uses of the `in-band` class are: https://github.com/rust-lang/rust/blob/02cd79afb8080fce8c8ce35533c54d8ecf8f390e/src/librustdoc/html/render/write_shared.rs#L520-L521 https://github.com/rust-lang/rust/blob/02cd79afb8080fce8c8ce35533c54d8ecf8f390e/src/librustdoc/html/templates/print_item.html#L2-L3 https://github.com/rust-lang/rust/blob/02cd79afb8080fce8c8ce35533c54d8ecf8f390e/src/librustdoc/html/render/context.rs#L637-L638 https://github.com/rust-lang/rust/blob/02cd79afb8080fce8c8ce35533c54d8ecf8f390e/src/librustdoc/html/render/mod.rs#L368-L369 https://github.com/rust-lang/rust/blob/02cd79afb8080fce8c8ce35533c54d8ecf8f390e/src/librustdoc/html/render/mod.rs#L401-L402 https://github.com/rust-lang/rust/blob/02cd79afb8080fce8c8ce35533c54d8ecf8f390e/src/librustdoc/html/static/js/main.js#L525 Since all of these uses are nested below `h1.fqn`, we can get rid of it, and the support code that was used for when `in-band` was part of item rendering.
2022-10-05rustdoc: render more cross-crate hrtbs properlyLeón Orell Valerian Liehr-1/+2
2022-10-05Rollup merge of #102699 - GuillaumeGomez:fix-hamburger-button-color, r=Dylan-DPCDylan DPC-0/+1
Fix hamburger button color Before: ![Screenshot from 2022-10-05 11-14-20](https://user-images.githubusercontent.com/3050060/194026621-e4df5750-92df-4194-a163-9787b45ace26.png) After: ![Screenshot from 2022-10-05 11-14-15](https://user-images.githubusercontent.com/3050060/194026618-6a365623-5181-4174-b6af-66962e5ba6a5.png) No need to backport it, beta doesn't seem affected. r? `@notriddle`
2022-10-05Fix hamburger button color in mobile sidebarGuillaume Gomez-0/+1
2022-10-04rustdoc: remove no-op CSS `.code-header { display: block }`Michael Howell-4/+0
Since 76a3b609d0b93c5d8da5e4e3db37bd03e5cb1c30 converted code headers to real headers, `display: block` is now the default.
2022-10-04Rollup merge of #102624 - notriddle:notriddle/summary-before, r=GuillaumeGomezMatthias Krüger-4/+0
rustdoc: remove font family CSS on `.rustdoc-toggle summary::before` This rule became irrelevant since c58246efe47bea09d4f3e70f536e4c9bb7770749 made it so that the `summary::before` pseudo-element contains an SVG instead of text.
2022-10-03Migrate search results theme style to CSS variablesGuillaume Gomez-84/+8
2022-10-03Rollup merge of #102620 - GuillaumeGomez:css-stab-migration, r=notriddleMatthias Krüger-20/+13
Migrate `.stab` elements style to CSS variables Part of https://github.com/rust-lang/rust/pull/98460. There should be no UI changes. r? `@notriddle`
2022-10-03rustdoc: remove font family CSS on `.rustdoc-toggle summary::before`Michael Howell-4/+0
This rule became irrelevant since c58246efe47bea09d4f3e70f536e4c9bb7770749 made it so that the `summary::before` pseudo-element contains an SVG instead of text.
2022-10-03Migrate stab elements style to CSS variablesGuillaume Gomez-20/+13
2022-10-03Rollup merge of #102550 - notriddle:notriddle/impl, r=GuillaumeGomezMatthias Krüger-12/+0
rustdoc: remove no-op CSS on `.impl, .method` etc Preview: http://notriddle.com/notriddle-rustdoc-demos/impl/index.html # `flex-basis: 100%` When `.impl-items { flex-basis: 100% }` and `h3.impl, h3.method, h4.method, h3.type, h4.type, h4.associatedconstant` were added in https://github.com/rust-lang/rust/commit/34bd2b845b3acd84c5a9bddae3ff8081c19ec5e9, it seems like it was a mistake even then. According to MDN, [flex-basis] does nothing unless the box it's applied to is a flex *item*, a child of a flex container. However, when this was added, these elements were flex containers themselves. [flex-basis]: https://developer.mozilla.org/en-US/docs/Web/CSS/flex-basis # `position: relative` This property was added to help with positioning the `[+]/[-]` toggle. It is no longer necessary, because `details.rustdoc-toggle` already has `position:relative` set on it.
2022-10-02Rollup merge of #102525 - notriddle:notriddle/array-link, r=GuillaumeGomez,jshaMatthias Krüger-8/+18
rustdoc: remove orphaned link on array bracket This is #98069, but for arrays instead. For non-generics, this retains links to the array page, but instead of trying to link it all, it only links the length part, which distinguishes arrays from slices. For generics, the entire thing becomes a link, just like slices. | Type | Before | After | |--|--|--| | u32 | <code>pub fn alpha() -&gt; &amp;'static <a class="primitive" href="http://doc.rust-lang.org/nightly/core/primitive.array.html">[</a><a class="primitive" href="http://doc.rust-lang.org/nightly/core/primitive.u32.html">u32</a><a class="primitive" href="http://doc.rust-lang.org/nightly/core/primitive.array.html">; 1]</a></code> | <code>pub fn alpha() -&gt; &amp;'static [<a class="primitive" href="http://doc.rust-lang.org/nightly/core/primitive.u32.html">u32</a>; <a class="primitive" href="http://doc.rust-lang.org/nightly/core/primitive.array.html">1</a>]</code> | generic | <code>pub fn beta&lt;T&gt;() -&gt; &amp;'static <a class="primitive" href="http://doc.rust-lang.org/nightly/core/primitive.array.html">[</a>T<a class="primitive" href="http://doc.rust-lang.org/nightly/core/primitive.array.html">; 1]</a></code> | <code>pub fn beta&lt;T&gt;() -&gt; &amp;'static <a class="primitive" href="http://doc.rust-lang.org/nightly/core/primitive.array.html">[T; 1]</a></code>
2022-10-01rustdoc: remove no-op CSS `.impl { position: relative }` etcMichael Howell-11/+0
This property was added to help with positioning the `[+]/[-]` toggle. It is no longer necessary, because `details.rustdoc-toggle` already has `position:relative` set on it.
2022-10-01rustdoc: remove no-op CSS `.impl { flex-basis: 100% }` etcMichael Howell-1/+0
When `.impl-items { flex-basis: 100% }` and `h3.impl, h3.method, h4.method, h3.type, h4.type, h4.associatedconstant` were added in 34bd2b845b3acd84c5a9bddae3ff8081c19ec5e9, it seems like it was a mistake even then. According to MDN, [flex-basis] does nothing unless the box it's applied to is a flex *item*, a child of a flex container. However, when this was added, these elements were flex containers themselves. [flex-basis]: https://developer.mozilla.org/en-US/docs/Web/CSS/flex-basis
2022-10-01Rollup merge of #102533 - notriddle:notriddle/a-source, r=Dylan-DPCMatthias Krüger-1/+0
rustdoc: remove unused CSS selector `a.source` The link with this class attribute was removed in https://github.com/rust-lang/rust/commit/4d16de01d0beb84dc4a351022ea5cb587b4ab557#diff-3fe025bd3bd6b48044d0bd8d8c3122de5ecdb1dcd72a9dbe3c24430883595012L1281-R1324
2022-10-01Auto merge of #101986 - WaffleLapkin:move_lint_note_to_the_bottom, r=estebankbors-5/+2
Move lint level source explanation to the bottom So, uhhhhh r? `@estebank` ## User-facing change "note: `#[warn(...)]` on by default" and such are moved to the bottom of the diagnostic: ```diff - = note: `#[warn(unsupported_calling_conventions)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678> + = note: `#[warn(unsupported_calling_conventions)]` on by default ``` Why warning is enabled is the least important thing, so it shouldn't be the first note the user reads, IMO. ## Developer-facing change `struct_span_lint` and similar methods have a different signature. Before: `..., impl for<'a> FnOnce(LintDiagnosticBuilder<'a, ()>)` After: `..., impl Into<DiagnosticMessage>, impl for<'a, 'b> FnOnce(&'b mut DiagnosticBuilder<'a, ()>) -> &'b mut DiagnosticBuilder<'a, ()>` The reason for this is that `struct_span_lint` needs to edit the diagnostic _after_ `decorate` closure is called. This also makes lint code a little bit nicer in my opinion. Another option is to use `impl for<'a> FnOnce(LintDiagnosticBuilder<'a, ()>) -> DiagnosticBuilder<'a, ()>` altough I don't _really_ see reasons to do `let lint = lint.build(message)` everywhere. ## Subtle problem By moving the message outside of the closure (that may not be called if the lint is disabled) `format!(...)` is executed earlier, possibly formatting `Ty` which may call a query that trims paths that crashes the compiler if there were no warnings... I don't think it's that big of a deal, considering that we move from `format!(...)` to `fluent` (which is lazy by-default) anyway, however this required adding a workaround which is unfortunate. ## P.S. I'm sorry, I do not how to make this PR smaller/easier to review. Changes to the lint API affect SO MUCH 😢
2022-10-01rustdoc: adopt to the new lint APIMaybe Waffle-5/+2
2022-10-01Auto merge of #102237 - GuillaumeGomez:sidebar-links-color, r=notriddlebors-63/+14
Migrate sidebar links color to CSS variables and unify themes with ayu Part of https://github.com/rust-lang/rust/pull/98460. This PR does two things: 1. Migrate more theme CSS rules toward CSS variables. 2. Remove `a.current` specific colors depending on the kind of the item behind the link. The `ayu` theme was already doing it this way and I think it makes much more sense like this. You can test it [here](https://rustdoc.crud.net/imperio/sidebar-links-color/lib2/struct.Foo.html) by hovering other module's items in the sidebar (or check the selector `a.current`). cc `@jsha` r? `@notriddle`
2022-09-30rustdoc: remove unused CSS selector `a.source`Michael Howell-1/+0
The link with this class attribute was removed in 4d16de01d0beb84dc4a351022ea5cb587b4ab557.
2022-09-30Rollup merge of #102521 - notriddle:notriddle/impl-items-section, ↵Matthias Krüger-3/+6
r=GuillaumeGomez rustdoc: add missing margin to no-docblock methods Fixes another regression caused by 8846c0853d8687fda0e5f23f6687b03b243980ee, this time fixing the appearance of methods that have no docblock (we didn't notice this one because libstd docs *always* have docblocks). See how it looks at https://doc.rust-lang.org/nightly/nightly-rustc/rustdoc/clean/types/enum.Type.html#implementations <details> # Before ![image](https://user-images.githubusercontent.com/1593513/193318777-2bc082fb-6579-4bd8-a0e3-d23a32b4820f.png) # After ![image](https://user-images.githubusercontent.com/1593513/193318968-b6ccacad-940b-4ed3-a0ae-dcf2079c2bae.png) </details> See how it looks at https://doc.rust-lang.org/nightly/nightly-rustc/rustdoc/clean/types/trait.AttributesExt.html <details> # Before ![image](https://user-images.githubusercontent.com/1593513/193319636-7ff9c99e-0208-462c-99de-7672e92ce4d6.png) # After ![image](https://user-images.githubusercontent.com/1593513/193322675-403bd165-7394-43e2-8ab4-d1f364666093.png) </details>
2022-09-30rustdoc: remove orphaned link on array bracketMichael Howell-8/+18
This is 682889fb06591c4245422b73b005c5d8ae2d0cad, but for arrays instead. For non-generics, this retains links to the array page, but instead of trying to link it all, it only links the length part, which distinguishes arrays from slices. For generics, the entire thing becomes a link, just like slices.
2022-09-30rustdoc: add missing margin to no-docblock trait itemsMichael Howell-3/+4
Fixes another regression caused by 8846c0853d8687fda0e5f23f6687b03b243980ee, this time fixing the appearance of methods that have no docblock (we didn't notice this one because libstd docs *always* have docblocks). See how it looks at https://doc.rust-lang.org/nightly/nightly-rustc/rustdoc/clean/types/trait.AttributesExt.html
2022-09-30Rollup merge of #102505 - notriddle:sub-variant-h4, r=GuillaumeGomezMatthias Krüger-2/+0
rustdoc: remove no-op CSS `h3.variant, .sub-variant h4 { border-bottom: none }` This rule, added in 69df43b041f76251391f11264c1ff763ca2a64a0 to override the default `h4` style, has been obsoleted when a65c98fefb78cddee955b87214732b0de30a769f changed it so that only the top docblock put `border-bottom` on `h4.`
2022-09-30rustdoc: add missing margin to no-docblock methodsMichael Howell-1/+3
Fixes another regression caused by 8846c0853d8687fda0e5f23f6687b03b243980ee, this time fixing the appearance of methods that have no docblock (we didn't notice this one because libstd docs *always* have docblocks). See how it looks without the fix at https://doc.rust-lang.org/nightly/nightly-rustc/rustdoc/clean/types/enum.Type.html#implementations
2022-09-30* Migrate sidebar links color to new CSS theme handlingGuillaume Gomez-63/+14
* Remove specific color handling for ".current" items in the sidebar.
2022-09-30Rollup merge of #102491 - notriddle:notriddle/sidebar-opacity, r=GuillaumeGomezMatthias Krüger-2/+0
rustdoc: remove no-op source sidebar `opacity` These rules were added in dc2c9723343c985740be09919236a6e96c4e4433 to work with CSS transitions. They're otherwise redundant, since the `visibility` property already hides everything. https://github.com/rust-lang/rust/blob/dc2c9723343c985740be09919236a6e96c4e4433/src/librustdoc/html/static/css/rustdoc.css#L350-L354 The transition was remove with 237d62588ddb4b7a93f3f5c61ea9253eba30ed5d, but the now-redundant `opacity` property was not.
2022-09-30Rollup merge of #102481 - notriddle:notriddle/rust-example-rendered, ↵Matthias Krüger-5/+0
r=GuillaumeGomez rustdoc: remove unneeded CSS `.rust-example-rendered { position }` The Run button isn't inside the `<pre>` any more. It's instead nested below the example wrapper. The class name can't be removed from the DOM, because `main.js` uses it.
2022-09-30rustdoc: remove no-op CSS `h3.variant, .sub-variant h4 { border-bottom: none }`Michael Howell-2/+0
This rule, added in 69df43b041f76251391f11264c1ff763ca2a64a0 to override the default `h4` style, has been obsoleted when a65c98fefb78cddee955b87214732b0de30a769f changed it so that only the top docblock put `border-bottom` on `h4.`
2022-09-29rustdoc: remove no-op source sidebar `opacity`Michael Howell-2/+0
These rules were added in dc2c9723343c985740be09919236a6e96c4e4433 to work with CSS transitions. They're otherwise redundant, since the `visibility` property already hides everything. https://github.com/rust-lang/rust/blob/dc2c9723343c985740be09919236a6e96c4e4433/src/librustdoc/html/static/css/rustdoc.css#L350-L354 The transition was remove with 237d62588ddb4b7a93f3f5c61ea9253eba30ed5d, but the now-redundant `opacity` property was not.
2022-09-29Rollup merge of #102447 - notriddle:notriddle/method-toggle, r=jshaMichael Howell-2/+3
rustdoc: add method spacing to trait methods More cleanup for 8846c0853d8687fda0e5f23f6687b03b243980ee, this time in trait layouts when things are collapsed. This PR makes two changes to the appearance of trait pages: * It adds the `method-toggle` class to method toggles on traits, making the DOM more consistent with type pages (which already have this class). ## Before ![image](https://user-images.githubusercontent.com/1593513/192914353-ed17e1eb-df1d-480b-9998-3b5e8283b0ee.png) ## After ![image](https://user-images.githubusercontent.com/1593513/192914570-bdd0f2e1-5254-4e2e-9576-a797b82b3b3b.png) * It adds a bottom margin to docblocks nested directly in the implementors list, giving it a similar appearance to if it was nested within a toggle. ## Before ![image](https://user-images.githubusercontent.com/1593513/192914503-1c3f39d5-690f-44ec-8f11-385302477d04.png) ## After ![image](https://user-images.githubusercontent.com/1593513/192914702-cbce4b3b-5cc6-49dc-b7f8-73be9e76791c.png)
2022-09-29Rollup merge of #102442 - notriddle:notriddle/header-weight, r=GuillaumeGomezMichael Howell-1/+0
rustdoc: remove bad CSS font-weight on `.impl`, `.method`, etc 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-29Rollup merge of #102437 - notriddle:notriddle/margin-top-h2, r=jshaMichael Howell-0/+7
rustdoc: cut margin-top from first header in docblock Fixes a regression caused by 8846c0853d8687fda0e5f23f6687b03b243980ee, where a header's top margin used to be collapsed, but isn't any more. ## Before ![image](https://user-images.githubusercontent.com/1593513/192893092-8e158bf7-ae18-41ef-8f11-6f34c724d345.png) ## After ![image](https://user-images.githubusercontent.com/1593513/192893139-d6ee06bf-9c0b-4194-bd5d-636312c89367.png)
2022-09-29rustdoc: remove unneeded CSS `.rust-example-rendered { position }`Michael Howell-5/+0
The Run button isn't inside the `<pre>` any more. It's instead nested below the example wrapper. The class name can't be removed from the DOM, because `main.js` uses it.
2022-09-29Rollup merge of #102436 - notriddle:notriddle/normalize-form, r=GuillaumeGomezDylan DPC-13/+11
rustdoc: clean up "normalize.css 8" input override CSS 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