about summary refs log tree commit diff
path: root/src/librustdoc
AgeCommit message (Collapse)AuthorLines
2021-05-03Valid underscores in hex/octal/binary literal docsSmitty-2/+62
Currently hex/octal/binary literals with computed values are displayed like `0_xff_fff_fffu32`, which is invalid since underscores can't be in the middle of integer prefixes. This properly formats prefixed integers.
2021-05-03Make match in `register_res` easier to readJoshua Nelson-20/+33
- Don't duplicate DefKind -> ItemType handling; that's a good way to get bugs - Use exhaustive match - Add comments This found that register_res is very wrong in at least one way: if it registers a Res for `Variant`, it should also register one for `Field`. But I don't know whether the one for Variant should be removed or Field added. Maybe someone has ideas?
2021-05-03Unify rustc and rustdoc parsing of `cfg()`Joshua Nelson-39/+27
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-03proof of concept add test type on printsAliénore Bouttefeux-1/+3
2021-05-03Change librustdoc write(.. \n) to writeln(..); fix comment in grammarmautamu-5/+5
More grammar
2021-05-03Rollup merge of #84832 - Stupremee:dont-print-vis-in-external-traits, r=jyn514Dylan DPC-3/+13
Do not print visibility in external traits This PR fixes the bug that caused traits, which were re-exported, having visibility modifiers in front of methods, which is invalid. It would be nice to add a test for this, but I don't even know if tests with multiple crates are possible. Resolves #81274
2021-05-03Rollup merge of #84811 - scottmcm:rustdoc-trait-alias-fix, r=jyn514Dylan DPC-17/+43
RustDoc: Fix bounds linking trait.Foo instead of traitalias.Foo Fixes #84782 The code was assuming `Trait` when adding bounds to the cache, so add a check on the DefId to see what its kind really is. r? `@jyn514` Before: ![image](https://user-images.githubusercontent.com/18526288/116775611-6a751e80-aa53-11eb-84d0-ed6b7782be3c.png) After: ![image](https://user-images.githubusercontent.com/18526288/116802227-d19cdc80-ab00-11eb-8133-7b34dd750da2.png)
2021-05-02Auto merge of #84754 - GuillaumeGomez:toggle-migration, r=jshabors-202/+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-02PR feedbackScott McMurray-6/+9
2021-05-02Do not print visibility in external traitsJustus K-3/+13
2021-05-02Improve code readabilityGuillaume Gomez-18/+18
2021-05-02Rollup merge of #84763 - tdelabro:shrink-doctree-module, r=jyn514Dylan DPC-15/+14
shrink doctree::Module helps https://github.com/rust-lang/rust/issues/76382
2021-05-02Add missing CSS rules for associated typesGuillaume Gomez-8/+11
2021-05-02Migrate trait and impl blocks' toggles intoGuillaume Gomez-185/+124
2021-05-01RustDoc: Fix bounds linking trait.Foo instead of traitalias.FooScott McMurray-16/+39
2021-05-01Auto merge of #83857 - ABouttefeux:master, r=jyn514bors-1/+13
added --no-run option for rustdoc resolve #59053 add `--no-run` option for `rustdoc` for compiling doc test but not running them. Intended for use with `--persist-doctests`.
2021-05-01compute where_outer on demand, remove it from ModuleTimothée Delabrouille-15/+14
2021-05-01Apply suggestions from code reviewAliénore Bouttefeux-1/+1
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
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-84/+88
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-30/+18
It can be calculated on-demand.
2021-04-30error when --no-run is present without --testAliénore Bouttefeux-1/+6
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-43/+47
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-28Rollup merge of #84636 - notriddle:data-aliases, r=jyn514,GuillaumeGomezJack Huey-2/+2
rustdoc: change aliases attribute to data-aliases 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-28Rollup merge of #84484 - jyn514:check-tools, r=Mark-SimulacrumJack Huey-1/+1
Don't rebuild rustdoc and clippy after checking bootstrap This works by unconditionally passing -Z unstable-options to the compiler. This has no affect in practice since bootstrap doesn't use `deny(rustc::internal)`. Fixes https://github.com/rust-lang/rust/issues/82461. r? ```@Mark-Simulacrum```
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-56/+56
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-128/+158
84304 - rustdoc: shrink Item::Attributes Helps with https://github.com/rust-lang/rust/issues/84304
2021-04-27Switch `rustc::internal` from deny to warnJoshua Nelson-1/+1
These should still obey deny-warnings.
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-85/+104
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-53/+64
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-26Rollup merge of #84574 - hi-rustin:rustin-patch-typo, r=jyn514Mara Bos-2/+2
rustdoc: Fix typos in maybe_inline_local fn Introduced by https://github.com/rust-lang/rust/pull/79061. r? `@jyn514`
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-26rustdoc: Fix typo for maybe_inline_local fnhi-rustin-2/+2
2021-04-25Auto merge of #84564 - Dylan-DPC:rollup-wxa2yr0, r=Dylan-DPCbors-4/+3
Rollup of 8 pull requests Successful merges: - #84235 (refactor StyledBuffer) - #84450 (Give a better error when `std` or `core` are missing) - #84486 (Handle pretty printing of `else if let` clauses without ICEing) - #84499 (Tweak trait not `use`d suggestion) - #84516 (Add suggestion to "use break" when attempting to implicit-break a loop) - #84520 (Improve diagnostics for function passed when a type was expected.) - #84541 (Inline most raw socket, fd and handle conversions) - #84547 (Get rid of is_min_const_fn) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
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
2021-04-25get rid of min_const_fn references in library/ and rustdocRalf Jung-4/+3