about summary refs log tree commit diff
path: root/src/librustdoc
AgeCommit message (Collapse)AuthorLines
2022-09-05Auto merge of #101386 - aDotInTheVoid:rdj-discriminant, r=GuillaumeGomezbors-19/+75
Rustdoc-Json: Add enum discriminant Does the first part of #101337, by adding it to `clean`, but doesn't change HTML output, as 1. [No Consensus has appeared on the UI for this](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/Enum.20discriminant.20values.20in.20HTML.20output) 2. [When inlining across crates, information is lost](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/.60clean_variant_def.20.60vs.20.60clean_variant_data.60) JSON doesn't have either of these limitations. r? `@GuillaumeGomez`
2022-09-04Rollup merge of #101397 - notriddle:notriddle/source-nav-not-sidebar-sub, ↵Matthias Krüger-4/+0
r=GuillaumeGomez rustdoc: remove redundant mobile-sized `.source nav:not(.sidebar).sub` It's redundant because there's already a selector `.source nav.sub` with exactly the same margin-left at [line 796]. [line 796]: https://github.com/rust-lang/rust/blob/84f0c3f79a85329dd79a54694ff8a7f427c842e9/src/librustdoc/html/static/css/rustdoc.css#L796 This selector was added in 1e98fb10274ea0245f865ddb1e295e454382000b, along with an identical desktop selector, but that desktop selector was removed in 6a5f8b1aef1417d7dc85b5d0a229d2db1930eb7c as part of a larger simplification.
2022-09-04rustdoc: Compute enum discriminant on demandNixon Enraght-Moony-24/+28
2022-09-03rustdoc: remove redundant mobile-sized `.source nav:not(.sidebar).sub`Michael Howell-4/+0
It's redundant because there's already a selector `.source nav.sub` with exactly the same margin-left at line 796. This selector was added in 1e98fb10274ea0245f865ddb1e295e454382000b, along with an identical desktop selector, but that desktop selector was removed in 6a5f8b1aef1417d7dc85b5d0a229d2db1930eb7c as part of a larger simplification.
2022-09-03rustdoc: remove `.impl-items { flex-basis }` CSS, not in flex containerMichael Howell-4/+0
Added in 34bd2b845b3acd84c5a9bddae3ff8081c19ec5e9 For this to actually do anything, [according to MDN] (and Firefox Dev Tools), it must be a "flex item", which only happens if its a direct child of a node with `display: flex` on it. It seems like it could not have worked at the time when this rule was added, because the only items in `rustdoc.css` with `display: flex` active were: * `#help` This should not contain anything like this. * `.impl-items h4, h4.impl, h3.impl` These are all headers, so they shouldn't contain `.impl-items` either. * `.content .impl-items .method, .content .impl-items > .type, .impl-items > .associatedconstant` Associated constants and methods definitely shouldn't contain a list of impl items, and the `.type` class seems to refer to type aliases, which, when shown inside of an impl, only show a link to the aliased type. [according to MDN]: https://developer.mozilla.org/en-US/docs/Web/CSS/flex-basis Nowadays, `display: flex` is a lot more prolific, but `.impl-items` still seems to only be used in plain block parents: * If it's not a trait impl, then it's nested below a `<div>` with an id but no class, added in a5216cf67d93de97091b41ecba85de2e08f39863. This will be `display: block`, probably. For example, [vec deref] * Inherent impls also get a `<div>` tag, for example [vec impl], and they are also wrapped by their own non-flexbox `<details>` tag. * If it's a tait implementation, then it's also nested below a `<details>` container, like [deref cstring]. [vec impl]: https://doc.rust-lang.org/1.63.0/std/vec/struct.Vec.html#impl [vec deref]: https://doc.rust-lang.org/1.63.0/std/vec/struct.Vec.html#deref-methods-%5BT%5D [deref cstring]: https://doc.rust-lang.org/1.63.0/std/ops/trait.Deref.html#impl-Deref Also, this would imply that trait items ought to take up as much space as possible, pushing everything else to the edge of the screen. If this is nested directly below the `.rustdoc` container, which has a row basis, that would be bad.
2022-09-03Rustdoc-Json: Add enum discriminantNixon Enraght-Moony-19/+71
2022-09-03more clippy::perf fixesMatthias Krüger-3/+3
2022-09-03Rollup merge of #101365 - matthiaskrgr:clones2, r=fee1-deadMatthias Krüger-1/+1
remove redundant clones
2022-09-03Rollup merge of #101335 - notriddle:notriddle/methods-stability, r=notriddleMatthias Krüger-8/+5
rustdoc: remove old CSS selector that causes weird spacing It was added with e08a84a0c18739417a50c3e46917ced5037244eb (actually, it was called `.methods > .stability` at the time) and was directly nested that way. **EDIT**: It is technically reachable code still, but it seems wrong. ## With the old CSS rule still present https://notriddle.com/notriddle-rustdoc-test/weird-spacing/lib/struct.Foo.html ![image](https://user-images.githubusercontent.com/1593513/188216226-c667c560-d33d-494f-a492-4e0ec3ac0009.png) ## Version 2 (an older version of this PR) https://notriddle.com/notriddle-rustdoc-test/normal-spacing-2/lib/struct.Foo.html ![image](https://user-images.githubusercontent.com/1593513/188216418-9fcd3109-f1b2-425d-b4fc-0c6b3b54e48e.png) ## Version 3 (with alignment fix for mobile) https://notriddle.com/notriddle-rustdoc-test/normal-spacing-3/lib/struct.Foo.html ![image](https://user-images.githubusercontent.com/1593513/188223161-0e1ebce7-842f-41cb-8a0c-ae43aedcfccc.png)
2022-09-03remove redundant clonesMatthias Krüger-1/+1
2022-09-03Clean up themes CSSGuillaume Gomez-91/+47
2022-09-02rustdoc: put in rule to get alignment in desktop and mobile layoutsMichael Howell-0/+5
2022-09-02rustdoc: remove incorrect CSS rule causing misaligned item-infoMichael Howell-4/+0
2022-09-02rustdoc: remove unused CSS selector `.methods > .item-info`Michael Howell-4/+0
It was added with e08a84a0c18739417a50c3e46917ced5037244eb (actually, it was called `.methods > .stability` at the time) and was directly nested that way. But with the switch to `<details>`, the code has changed drastically out from under it, to the point where you have to go out of your way to actually get it to render this way, and the result looks overly-tight and weird alongside the normal version where this code is not reachable.
2022-09-02Rollup merge of #101323 - GuillaumeGomez:remove-unused-css, r=notriddleMatthias Krüger-9/+0
Remove unused .toggle-label CSS rule It was added in https://github.com/rust-lang/rust/pull/44192 but since we moved to `<details>`, we don't use this rule any more. r? `@notriddle`
2022-09-02Remove unused .toggle-label CSS ruleGuillaume Gomez-9/+0
2022-09-02Rollup merge of #101298 - notriddle:notriddle/rustdoc-main-since, ↵Guillaume Gomez-1/+0
r=GuillaumeGomez rustdoc: remove unused CSS `#main-content > .since` This rule was added (actually, it was called `#main > .since` back then) with cdca0843779eed0b9046e9fee48c91458ad51605 and you can see an example of the bug it's intended to fix in <https://doc.rust-lang.org/1.9.0/std/fmt/fn.write.html> by looking at the `1.0.0` version marker. However, a5a2f2b951ea982a666eaf52b1874d8f1b17290b changed it so that `<span class="since">` is always placed in an out-of-band wrapper, so it's never nested directly below `#main` / `#main-content` any more.
2022-09-01rustdoc: remove unused CSS `#main-content > .since`Michael Howell-1/+0
This rule was added (actually, it was called `#main > .since` back then) with cdca0843779eed0b9046e9fee48c91458ad51605 and you can see an example of the bug it's intended to fix in <https://doc.rust-lang.org/1.9.0/std/fmt/fn.write.html> by looking at the `1.0.0` version marker. However, a5a2f2b951ea982a666eaf52b1874d8f1b17290b changed it so that `<span class="since">` is always placed in an out-of-band wrapper, so it's never nested directly below `#main` / `#main-content` any more.
2022-09-01Rollup merge of #101292 - rust-lang:notriddle/rustdoc-table-first-child, ↵Matthias Krüger-1/+0
r=GuillaumeGomez rustdoc: remove unneeded CSS `.content table td:first-child > a` This rule was added in c1c6175e62189f8f0e6479bff7bac0e59a95a406 to benefit the module items table. However, the module items table stopped using table tags when 6020c79ddeafe8d9760b27c14c39da81bac9b4a6 switched us over to grid layout.
2022-09-01Rollup merge of #101279 - GuillaumeGomez:doc_auto_cfg_nested_impl, r=notriddleMatthias Krüger-20/+40
Fix doc_auto_cfg for impl blocks in different modules with different `cfg` Fixes #101129. Just like reexports, impl blocks don't necessarily share the same "space" as the item they implement so we need to merge attributes from its parents as well. r? `@notriddle`
2022-09-01Rollup merge of #101274 - aDotInTheVoid:comment-typo, r=TaKO8KiMatthias Krüger-1/+1
Fix typo in comment
2022-09-01Rollup merge of #101254 - rust-lang:notriddle/remove-even-more-css, r=jshaMatthias Krüger-8/+0
rustdoc: remove unused `.docblock .impl-items` CSS The impl-items list stopped being nested inside a docblock since c1b1d6804bfce1aee3a95b3cbff3eaeb15bad9a4
2022-09-01Rollup merge of #101245 - GuillaumeGomez:remove-unneeded-where-whitespace, ↵Matthias Krüger-15/+10
r=notriddle Remove unneeded where whitespace It fixes these two bugs: ![Screenshot from 2022-08-31 18-14-40](https://user-images.githubusercontent.com/3050060/187727950-94657419-abfa-454c-9d27-004280fbcb45.png) ![Screenshot from 2022-08-31 18-14-49](https://user-images.githubusercontent.com/3050060/187727956-21d1b39d-62d7-4e7b-8f6f-631ceda67a19.png) It's a relic from a very old time (this commit: https://github.com/rust-lang/rust/commit/bfd01b7f40ae2cbfe9acbc1d10e79ffe16870df8). You can test the result [here](https://rustdoc.crud.net/imperio/remove-unneeded-where-whitespace/lib2/struct.WhereWhitespace.html). cc `````````@jsha````````` r? `````````@notriddle`````````
2022-09-01rustdoc: remove unneeded CSS `.content table td:first-child > a`Michael Howell-1/+0
This rule was added in c1c6175e62189f8f0e6479bff7bac0e59a95a406 to benefit the module items table. However, the module items table stopped using table tags when 6020c79ddeafe8d9760b27c14c39da81bac9b4a6 switched us over to grid layout.
2022-09-01tracing::instrument cleanupOli Scherer-4/+2
2022-09-01Sort tests at compile time, not at startupBen Kimock-1/+2
Recently, another Miri user was trying to run `cargo miri test` on the crate `iced-x86` with `--features=code_asm,mvex`. This configuration has a startup time of ~18 minutes. That's ~18 minutes before any tests even start to run. The fact that this crate has over 26,000 tests and Miri is slow makes a lot of code which is otherwise a bit sloppy but fine into a huge runtime issue. Sorting the tests when the test harness is created instead of at startup time knocks just under 4 minutes out of those ~18 minutes. I have ways to remove most of the rest of the startup time, but this change requires coordinating changes of both the compiler and libtest, so I'm sending it separately.
2022-09-01Correctly merge impl block cfg attributes with its parentsGuillaume Gomez-20/+40
2022-09-01Fix typo in commentNixon Enraght-Moony-1/+1
2022-09-01Auto merge of #100869 - nnethercote:replace-ThinVec, r=spastorinobors-34/+33
Replace `rustc_data_structures::thin_vec::ThinVec` with `thin_vec::ThinVec` `rustc_data_structures::thin_vec::ThinVec` looks like this: ``` pub struct ThinVec<T>(Option<Box<Vec<T>>>); ``` It's just a zero word if the vector is empty, but requires two allocations if it is non-empty. So it's only usable in cases where the vector is empty most of the time. This commit removes it in favour of `thin_vec::ThinVec`, which is also word-sized, but stores the length and capacity in the same allocation as the elements. It's good in a wider variety of situation, e.g. in enum variants where the vector is usually/always non-empty. The commit also: - Sorts some `Cargo.toml` dependency lists, to make additions easier. - Sorts some `use` item lists, to make additions easier. - Changes `clean_trait_ref_with_bindings` to take a `ThinVec<TypeBinding>` rather than a `&[TypeBinding]`, because this avoid some unnecessary allocations. r? `@spastorino`
2022-09-01Auto merge of #100707 - dzvon:fix-typo, r=davidtwcobors-4/+4
Fix a bunch of typo This PR will fix some typos detected by [typos]. I only picked the ones I was sure were spelling errors to fix, mostly in the comments. [typos]: https://github.com/crate-ci/typos
2022-08-31rustdoc: remove unused `.docblock .impl-items` CSSMichael Howell-8/+0
The impl-items list stopped being nested inside a docblock since c1b1d6804bfce1aee3a95b3cbff3eaeb15bad9a4
2022-08-31Remove unneeded extra whitespace before where clauseGuillaume Gomez-15/+10
2022-08-31Rollup merge of #101204 - aDotInTheVoid:async-resugar-in-clean, r=GuillaumeGomezRalf Jung-16/+10
rustdoc: Resugar async fn return type in `clean`, not `html` This way it also happens for json output. Fixes #101199 r? ``@GuillaumeGomez``
2022-08-31Rollup merge of #90946 - GuillaumeGomez:def-id-remove-weird-case, r=ManishearthRalf Jung-118/+182
Ignore `reference`s in "Type::inner_def_id" Fixes #90775. Reopening of #90726. As discussed on [zulip](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/rendering.20for.20reference.20primitive.20doc.20page), the reference page shouldn't list these implementations (since they are listed on the types and on the traits in any case). And more generally, you don't implement something on a reference but on something behind a reference. I think it's the important point. So currently it looks like this: ![Screenshot from 2021-11-16 10-20-41](https://user-images.githubusercontent.com/3050060/141957799-57aeadc5-41f8-45f6-a4a5-33b1eca6a500.png) With this PR, only the implementations over generics behind a reference are kept. You can test it [here](https://rustdoc.crud.net/imperio/def-id-remove-weird-case/std/primitive.reference.html). cc ``@camelid``
2022-08-31Fix a bunch of typoDezhi Wu-4/+4
This PR will fix some typos detected by [typos]. I only picked the ones I was sure were spelling errors to fix, mostly in the comments. [typos]: https://github.com/crate-ci/typos
2022-08-31Print only blanket implementations on reference primitive typeGuillaume Gomez-67/+133
2022-08-30Stabilize GATsJack Huey-1/+1
2022-08-31Rollup merge of #100804 - GuillaumeGomez:search-results-color-ayu, r=notriddleYuki Okushi-3/+4
Fix search results color on hover for ayu theme Before: ![image](https://user-images.githubusercontent.com/3050060/185747851-038d2333-8b01-44a8-a104-ceb7410ac089.png) After: ![image](https://user-images.githubusercontent.com/3050060/185747869-53b502f5-5800-470f-b897-2683f1cdb7ee.png) You can test it [here](https://rustdoc.crud.net/imperio/search-results-color-ayu/foo/index.html?search=item). r? ``@jsha``
2022-08-30Clean up render_assoc_items_inner a bitGuillaume Gomez-54/+52
2022-08-30rustdoc: Resugar async fn return type in `clean`, not `html`Nixon Enraght-Moony-16/+10
This way it also happens for json output. Fixes #101199
2022-08-30Auto merge of #101183 - Dylan-DPC:rollup-6kewixv, r=Dylan-DPCbors-35/+2
Rollup of 9 pull requests Successful merges: - #95376 (Add `vec::Drain{,Filter}::keep_rest`) - #100092 (Fall back when relating two opaques by substs in MIR typeck) - #101019 (Suggest returning closure as `impl Fn`) - #101022 (Erase late bound regions before comparing types in `suggest_dereferences`) - #101101 (interpret: make read-pointer-as-bytes a CTFE-only error with extra information) - #101123 (Remove `register_attr` feature) - #101175 (Don't --bless in pre-push hook) - #101176 (rustdoc: remove unused CSS selectors for `.table-display`) - #101180 (Add another MaybeUninit array test with const) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-08-30Rollup merge of #101176 - notriddle:notriddle/rustdoc-table-display, r=jshaDylan DPC-35/+2
rustdoc: remove unused CSS selectors for `.table-display` This class was added to support the function signature [src] lockup. That lockup was changed in 34bd2b845b3acd84c5a9bddae3ff8081c19ec5e9 to use flexbox instead, leaving these selectors unused. Continuation of #101046
2022-08-30Auto merge of #100812 - Nilstrieb:revert-let-chains-nightly, r=Mark-Simulacrumbors-0/+1
Revert let_chains stabilization This is the revert against master, the beta revert was already done in #100538. Bumps the stage0 compiler which already has it reverted.
2022-08-29rustdoc: remove unused CSS selectors for `.table-display`Michael Howell-35/+2
This class was added to support the function signature [src] lockup. That lockup was changed in 34bd2b845b3acd84c5a9bddae3ff8081c19ec5e9 to use flexbox instead, leaving these selectors unused.
2022-08-29Auto merge of #101167 - matthiaskrgr:rollup-yt3jdmp, r=matthiaskrgrbors-3/+51
Rollup of 7 pull requests Successful merges: - #100898 (Do not report too many expr field candidates) - #101056 (Add the syntax of references to their documentation summary.) - #101106 (Rustdoc-Json: Retain Stripped Modules when they are imported, not when they have items) - #101131 (CTFE: exposing pointers and calling extern fn is just impossible) - #101141 (Simplify `get_trait_ref` fn used for `virtual_function_elimination`) - #101146 (Various changes to logging of borrowck-related code) - #101156 (Remove `Sync` requirement from lint pass objects) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-08-29Rollup merge of #101106 - aDotInTheVoid:rdj-stripped-mod, r=GuillaumeGomezMatthias Krüger-3/+51
Rustdoc-Json: Retain Stripped Modules when they are imported, not when they have items Fixes #101103 Fixes #100973 r? `@GuillaumeGomez`
2022-08-29Revert let_chains stabilizationNilstrieb-0/+1
This reverts commit 326646074940222d602f3683d0559088690830f4. This is the revert against master, the beta revert was already done in #100538.
2022-08-29Rollup merge of #99821 - cjgillot:ast-lifetimes-2, r=compiler-errorsDylan DPC-1/+1
Remove separate indexing of early-bound regions ~Based on https://github.com/rust-lang/rust/pull/99728.~ This PR copies some modifications from https://github.com/rust-lang/rust/pull/97839 around object lifetime defaults. These modifications allow to stop counting generic parameters during lifetime resolution, and rely on the indexing given by `rustc_typeck::collect`.
2022-08-29Replace `rustc_data_structures::thin_vec::ThinVec` with `thin_vec::ThinVec`.Nicholas Nethercote-34/+33
`rustc_data_structures::thin_vec::ThinVec` looks like this: ``` pub struct ThinVec<T>(Option<Box<Vec<T>>>); ``` It's just a zero word if the vector is empty, but requires two allocations if it is non-empty. So it's only usable in cases where the vector is empty most of the time. This commit removes it in favour of `thin_vec::ThinVec`, which is also word-sized, but stores the length and capacity in the same allocation as the elements. It's good in a wider variety of situation, e.g. in enum variants where the vector is usually/always non-empty. The commit also: - Sorts some `Cargo.toml` dependency lists, to make additions easier. - Sorts some `use` item lists, to make additions easier. - Changes `clean_trait_ref_with_bindings` to take a `ThinVec<TypeBinding>` rather than a `&[TypeBinding]`, because this avoid some unnecessary allocations.
2022-08-29Rollup merge of #101116 - GuillaumeGomez:rm-attrs-ty-alias, r=notriddleMatthias Krüger-8/+6
[rustdoc] Remove Attrs type alias When working on https://github.com/rust-lang/rust/pull/101006, I was quite confused because of this type alias as I'm used to having rustdoc types into `clean/types.rs`. Anyway, considering how few uses of it we have, I simply removed it. r? `````@notriddle`````