about summary refs log tree commit diff
path: root/src/librustdoc/html
AgeCommit message (Collapse)AuthorLines
2021-05-11Add `tcx` local variableCamelid-3/+4
2021-05-11Fix a few small thingsCamelid-6/+6
2021-05-11Only show type layout info if `--show-type-layout` is passedCamelid-0/+8
2021-05-11Show memory layout for type aliasesCamelid-1/+4
At first you might think "why not just click through to the aliased type?", but if a type alias instantiates all of the generic parameters of the aliased type, then it can show layout info even though the aliased type cannot (because we can't compute the layout of a generic type). So I think it's still useful to show layout info for type aliases.
2021-05-11Include a warning in the layout docs that layout is unstableCamelid-3/+12
2021-05-11Remove FIXMECamelid-2/+4
Layout errors can occur with valid code, e.g. generic types.
2021-05-11rustdoc: Show basic type layout informationCamelid-3/+36
Right now it just shows the size.
2021-05-11Fix border radius for doc code blocks in rustdocGuillaume Gomez-2/+2
2021-05-10Rollup merge of #85148 - GuillaumeGomez:source-code-line-number, r=jshaGuillaume Gomez-19/+27
Fix source code line number display and make it clickable again Fixes https://github.com/rust-lang/rust/issues/85119. I used the same logic we're using for other codeblocks: putting the line number `<span>`s into the `example-wrap` directly and then add `display: inline-flex` on `example-wrap`. r? `@jsha`
2021-05-10Use an SVG image for clipboard instead of unicode characterGuillaume Gomez-11/+49
2021-05-10Fix line number not being clickable on source pagesGuillaume Gomez-19/+27
2021-05-10Update documentation for SharedContext::maybe_collapsed_doc_valueGuillaume Gomez-2/+2
2021-05-10Auto merge of #85074 - GuillaumeGomez:end-toggle-migration, r=jshabors-217/+68
Migrate top doc and non-exhaustive toggles to details tag Fixes #83332. r? `@jsha`
2021-05-10End toggle migrationGuillaume Gomez-217/+68
2021-05-07Rollup merge of #84442 - jyn514:doc-cfg, r=petrochenkovDylan DPC-2/+2
Unify rustc and rustdoc parsing of `cfg()` This extracts a new `parse_cfg` function that's used between both. - Treat `#[doc(cfg(x), cfg(y))]` the same as `#[doc(cfg(x)] #[doc(cfg(y))]`. Previously it would be completely ignored. - Treat `#[doc(inline, cfg(x))]` the same as `#[doc(inline)] #[doc(cfg(x))]`. Previously, the cfg would be ignored. - Pass the cfg predicate through to rustc_expand to be validated Technically this is a breaking change, but doc_cfg is still nightly so I don't think it matters. Fixes https://github.com/rust-lang/rust/issues/84437. r? `````````@petrochenkov`````````
2021-05-05Update highlight testsGuillaume Gomez-11/+16
2021-05-05Remove unneeded call to with_default_session_globals in rustdoc highlightGuillaume Gomez-20/+17
2021-05-05Use local and remapped paths where appropriateAndy Wang-14/+11
2021-05-05Make local_path in RealFileName::Remapped Option to be removed in exported ↵Andy Wang-6/+19
metadata
2021-05-04Add type to differentiate between fake and real DefId'sJustus K-38/+49
2021-05-03Unify rustc and rustdoc parsing of `cfg()`Joshua Nelson-2/+2
This extracts a new `parse_cfg` function that's used between both. - Treat `#[doc(cfg(x), cfg(y))]` the same as `#[doc(cfg(x)] #[doc(cfg(y))]`. Previously it would be completely ignored. - Treat `#[doc(inline, cfg(x))]` the same as `#[doc(inline)] #[doc(cfg(x))]`. Previously, the cfg would be ignored. - Pass the cfg predicate through to rustc_expand to be validated Co-authored-by: Vadim Petrochenkov <vadim.petrochenkov@gmail.com>
2021-05-03Change librustdoc write(.. \n) to writeln(..); fix comment in grammarmautamu-4/+4
More grammar
2021-05-02Auto merge of #84754 - GuillaumeGomez:toggle-migration, r=jshabors-198/+144
Migrate trait and impl blocks' toggles into Part of #83332 After this, I think only the "global" doc comment will be used as JS toggle. Once this PR is merged, I check what remains and remove them. There is one change that this PR brings: ![Screenshot from 2021-04-30 15-39-04](https://user-images.githubusercontent.com/3050060/116713412-0f9ce200-a9d5-11eb-979c-2e7a73d16706.png) ![Screenshot from 2021-04-30 15-39-07](https://user-images.githubusercontent.com/3050060/116713415-10357880-a9d5-11eb-9868-1ba9e5ebf65e.png) As you can see, I had to move the "undocumented" items below, they're not mixed with the others anymore. Unfortunately, I don't see a way to keep the current appearance without JS. As a a reminder, currently it looks like this: ![Screenshot from 2021-04-30 15-39-12](https://user-images.githubusercontent.com/3050060/116713547-31966480-a9d5-11eb-90bb-686042eefeec.png) ![Screenshot from 2021-04-30 15-39-15](https://user-images.githubusercontent.com/3050060/116713549-322efb00-a9d5-11eb-94a9-cfea073120db.png) r? `@jsha`
2021-05-02Improve code readabilityGuillaume Gomez-18/+18
2021-05-02Add missing CSS rules for associated typesGuillaume Gomez-8/+11
2021-05-02Migrate trait and impl blocks' toggles intoGuillaume Gomez-181/+124
2021-05-01Rollup merge of #84740 - r00ster91:patch-6, r=GuillaumeGomezYuki Okushi-20/+35
Reset the docs' copy path button after 1 second I like that this copy path button on the top next to the type/module's name changes to a check mark when you successfully clicked and copied the path but I find it really weird how the icon stays that check mark forever after the first time of clicking it. Imagine you leave that documentation tab open and come back after 2 hours and you still see that check mark in that box because you copied the path 2 hours ago. You will probably be confused and you might've forgotten what that button even does (even more so currently where this is a new feature, or when you simply don't use it often), so I really think at some point it should go back to the ⎘ icon which, at least to me, pretty clearly indicates copying, whereas the check mark (if it stays there for so long) could falsely look like a verification mark indicating "this module is verified" or something like that. I believe after a longer period of time it's not logical to still tell the user "yes you've copied this successful". In addition to this timeout, maybe it could be made so that you can't copy again until this cooldown of 1 second is over, but I'm not sure how useful or user-friendly that feature would be so maybe it's fine the way it is now. Also the timeout is cleared every time you click again so if you constantly click it, it won't reset during that.
2021-05-01Rollup merge of #84601 - tdelabro:rustdoc-get-rid-of-cache-extern_locations, ↵Yuki Okushi-59/+22
r=jyn514 rustdoc: Only store locations in Cache::extern_locations and calculate the other info on-demand help #84588
2021-04-30Remove unnecessary `provided_trait_methods` field from ImplJoshua Nelson-6/+7
It can be calculated on-demand.
2021-04-30`copy_path` -> `window.copy_path` + add semicolonr00ster-2/+2
2021-04-30Apply suggestionsr00ster-29/+34
2021-04-30Reset the docs' copy path button after 1 secondr00ster-0/+10
2021-04-29Rollup merge of #84690 - ↵Jack Huey-1/+0
GuillaumeGomez:unneeded-bottom-margin-search-results, r=Nemo157 Remove unneeded bottom margin on search results As you can see, there is still more than enough space at the bottom: ![Screenshot from 2021-04-29 11-26-57](https://user-images.githubusercontent.com/3050060/116530090-ea797800-a8dd-11eb-8eef-2288cf68e0d2.png) r? ``````@Nemo157``````
2021-04-29Rollup merge of #84688 - ↵Jack Huey-7/+0
GuillaumeGomez:remove-unnecessary-css-for-search-results, r=Nemo157 Remove unnecessary CSS rules for search results Discovered that this was useless when working on https://github.com/rust-lang/docs.rs/issues/1382. r? ````````@Nemo157````````
2021-04-29Rollup merge of #84451 - torhovland:flex, r=jshaJack Huey-14/+8
Use flex more consistently Builds on #84376, related to #84354. - Fully replaces `float: right` with `flex` on `.content .out-of-band`. - Uses `flex` more consistently with existing usage (on `h3`, `h4`, etc.). Tested on various widths to make sure the pages behave as before.
2021-04-29only store locations in extern_locationsTimothée Delabrouille-14/+20
2021-04-29Remove unneeded bottom margin on search resultsGuillaume Gomez-1/+0
2021-04-29Remove unnecessary CSS rules for search resultsGuillaume Gomez-7/+0
2021-04-28rustdoc: change aliases attribute to data-aliasesMichael Howell-2/+2
The "aliases" attribute is not listed [on MDN], so it sounds like it's rustdoc-specific. We don't want to conflict with any attributes that are added to the spec in the future. [on MDN]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Heading_Elements
2021-04-28added methods src_root and location to External crate, remove ↵Timothée Delabrouille-45/+2
extern_location function
2021-04-28Rollup merge of #84616 - GuillaumeGomez:fix-empty-dom-toggle, r=jshaYuki Okushi-97/+112
Fix empty dom toggle Currently, the empty impl blocks have toggles: ![Screenshot from 2021-04-27 15-15-03](https://user-images.githubusercontent.com/3050060/116249703-5ee0d980-a76d-11eb-9e15-738c06e4fb1b.png) So when you expand it, nothing happens: ![Screenshot from 2021-04-27 15-15-07](https://user-images.githubusercontent.com/3050060/116249746-686a4180-a76d-11eb-8dc1-221ca0ac57c5.png) So now, in case the impl block is empty, we simply don't generate the details/summary wrapping (which also makes DOM lighter, yeay!): ![Screenshot from 2021-04-27 15-14-15](https://user-images.githubusercontent.com/3050060/116249825-7a4be480-a76d-11eb-9637-b26151311ebd.png) r? `@jsha`
2021-04-27Auto merge of #84494 - tdelabro:84304-bis, r=jyn514bors-19/+15
84304 - rustdoc: shrink Item::Attributes Helps with https://github.com/rust-lang/rust/issues/84304
2021-04-27Don't put empty implementations into details/summary blocksGuillaume Gomez-97/+112
2021-04-27cfg taken out of Attributes, put in ItemTimothée Delabrouille-17/+10
check item.is_fake() instead of self_id.is_some() Remove empty branching in Attributes::from_ast diverse small refacto after Josha review cfg computation moved in merge_attrs refacto use from_ast twice for coherence take cfg out of Attributes and move it to Item
2021-04-27Removed usage of Attributes in FnDecl and ExternalCrate. Relocate part of ↵Timothée Delabrouille-4/+7
the fields in Attributes, as functions in AttributesExt. refacto use from_def_id_and_attrs_and_parts instead of an old trick most of josha suggestions + check if def_id is not fake before using it in a query Removed usage of Attributes in FnDecl and ExternalCrate. Relocate part of the Attributes fields as functions in AttributesExt.
2021-04-27Auto merge of #84552 - GuillaumeGomez:open-impl-blocks-by-default, r=jshabors-4/+6
Open impl blocks by default Fixes #84558. Part of #84422. As you can see on https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html, impl blocks are currently not open by default whereas they should. I also realized that a test was outdated so I removed it and opened #84550 because it seems like the rustdoc-gui test suite isn't run on CI... cc `@jyn514` r? `@jsha`
2021-04-26Add open attribute on details which are supposed to be open by default ↵Guillaume Gomez-4/+2
instead of opening them with JS
2021-04-25Auto merge of #84325 - jsha:ephemeral-collapse, r=GuillaumeGomezbors-28/+18
rustdoc: make expand/collapse all ephemeral The `[+]` in the upper right of a rustdoc page expands or collapses all toggles on the page. That state is stored across page loads, but is used inconsistently. This change explicitly stops storing or using the state. This also moves the code for toggling display of trait implementations so that it's near the other toggling code. Fixes #84318
2021-04-25Fix expansion for item pointed to by the URL hashGuillaume Gomez-0/+2
2021-04-25Open all impl blocks by defaultGuillaume Gomez-2/+4