about summary refs log tree commit diff
path: root/src/librustdoc
AgeCommit message (Collapse)AuthorLines
2021-06-12dont ICE on `ConstEvaluatable` predicatesEllen-1/+1
2021-06-09Rollup merge of #86128 - jsha:render-impl-into-mod, r=GuillaumeGomezYuki Okushi-78/+86
Refactor: Extract render_summary from render_impl. This allows for a more readable straight-through logic in render_impl without need for a closure. I think this will make #85970 a bit more of a straightforward change. This is a pure refactoring. I've verified that the output of `x.py doc library/std` is byte-for-byte identical. r? `@GuillaumeGomez`
2021-06-09Rollup merge of #85957 - BoxyUwU:rustdoc-const-generic-defaults, r=oli-obkYuki Okushi-9/+32
Display defaults on const params- rustdoc previously rustdoc would render this struct declaration: `pub struct Foo<const N: usize = 10>;` as: `pub struct Foo<const N: usize>;` this PR changes it to render correctly
2021-06-07Refactor: Extract render_summary from render_impl.Jacob Hoffman-Andrews-78/+86
This allows for a more readable straight-through logic in render_impl without need for a closure.
2021-06-08Rollup merge of #86095 - GuillaumeGomez:search-description-codeblock, r=jshaYuki Okushi-1/+1
Search description codeblock The codeblocks are not displayed correctly: ![Screenshot from 2021-06-07 11-11-53](https://user-images.githubusercontent.com/3050060/120991915-5fb05680-c782-11eb-9b32-973a64b1f631.png) This PR interprets the HTML correctly (and still prevent invalid HTML because of how it inserts it): ![Screenshot from 2021-06-07 11-12-00](https://user-images.githubusercontent.com/3050060/120991919-6048ed00-c782-11eb-8ac5-c3aa6508bc8b.png) r? ```@jsha```
2021-06-08Rollup merge of #86078 - GuillaumeGomez:type-page-font-weight, r=jshaYuki Okushi-1/+1
Type page font weight Fixes https://github.com/rust-lang/rust/issues/86069. r? ```@jsha```
2021-06-07Fix integration of codeblocks in search result descriptionGuillaume Gomez-1/+1
2021-06-07format versionEllen-1/+1
2021-06-07Rollup merge of #86040 - GuillaumeGomez:search-result-display-height, r=jshaGuillaume Gomez-0/+2
Fix display for search results This fixes unwanted margin and font-weight coming from `.method`. Before: ![Screenshot from 2021-06-05 23-03-34](https://user-images.githubusercontent.com/3050060/120905486-9e46f380-c652-11eb-8008-6db6e0517ba3.png) after: ![Screenshot from 2021-06-05 23-05-02](https://user-images.githubusercontent.com/3050060/120905489-9edf8a00-c652-11eb-817d-f676f6ab7303.png) r? ``@jsha``
2021-06-06Fix invalid weight for type pagesGuillaume Gomez-1/+1
2021-06-06Auto merge of #86054 - JohnTitor:rollup-j40z7sm, r=JohnTitorbors-4/+10
Rollup of 8 pull requests Successful merges: - #85436 (Avoid cloning cache key) - #85772 (Preserve metadata w/ Solaris-like linkers.) - #85920 (Tweak wasm_base target spec to indicate linker is not GNU and update linker inferring logic for wasm-ld.) - #85930 (Update standard library for IntoIterator implementation of arrays ) - #85972 (Rustdoc html fixes) - #86028 (Drop an `if let` that will always succeed) - #86043 (don't clone attrs) - #86047 (Don't fire `invalid_doc_attributes` on `extern crate` items) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-06-06Auto merge of #84863 - ABouttefeux:libtest, r=m-ou-sebors-1/+5
Show test type during prints Test output can sometimes be confusing. For example doctest with the no_run argument are displayed the same way than test that are run. During #83857 I got the feedback that test output can be confusing. For the moment test output is ``` test $DIR/test-type.rs - f (line 12) ... ignored test $DIR/test-type.rs - f (line 15) ... ok test $DIR/test-type.rs - f (line 21) ... ok test $DIR/test-type.rs - f (line 6) ... ok ``` I propose to change output by indicating the test type as ``` test $DIR/test-type.rs - f (line 12) ... ignored test $DIR/test-type.rs - f (line 15) - compile ... ok test $DIR/test-type.rs - f (line 21) - compile fail ... ok test $DIR/test-type.rs - f (line 6) ... ok ``` by indicating the test type after the test name (and in the case of doctest after the function name and line) and before the "...". ------------ Note: this is a proof of concept, the implementation is probably not optimal as the properties added in `TestDesc` are only use in the display and does not represent actual change of behavior, maybe `TestType::DocTest` could have fields
2021-06-05Fix invalid ID value in all.html fileGuillaume Gomez-2/+8
2021-06-05Add missing backslash in HTML layout stringGuillaume Gomez-1/+1
2021-06-05Escape <meta> content attribute valueGuillaume Gomez-1/+1
2021-06-05Fix display for search resultsGuillaume Gomez-0/+2
2021-06-05Rollup merge of #85503 - liigo:tooltips, r=GuillaumeGomezGuillaume Gomez-4/+4
rustdoc: add tooltips to some buttons
2021-06-05Rollup merge of #85501 - jyn514:invalid-doc-attrs, r=varkorGuillaume Gomez-1/+2
Fix `deny(invalid_doc_attributes)` Fixes https://github.com/rust-lang/rust/issues/85497.
2021-06-05Auto merge of #85990 - jyn514:channel-replace-rustdoc, r=Manishearthbors-7/+17
rustdoc: link consistently to stable/beta in diagnostic messages Builds on https://github.com/rust-lang/rust/pull/84942. This makes the diagnostics consistent with the links.
2021-06-05Auto merge of #85457 - jyn514:remove-doc-include, r=GuillaumeGomezbors-88/+5
Remove `doc(include)` This nightly feature is redundant now that `extended_key_value_attributes` is stable (https://github.com/rust-lang/rust/pull/83366). `@rust-lang/rustdoc` not sure if you think this needs FCP; there was already an FCP in #82539, but technically it was for deprecating, not removing the feature altogether. This should not be merged before #83366. cc `@petrochenkov`
2021-06-05Rollup merge of #84942 - jyn514:channel-replace, r=ManishearthYuki Okushi-1/+8
rustdoc: link to stable/beta docs consistently in documentation This is an alternative to https://github.com/rust-lang/rust/pull/84941 which fixes the problem consistently by linking to stable/beta for *all* items, not just for primitives. ## User-facing changes - Intra-doc links to primitives that currently go to rust-lang.org/nightly/std/primitive.x.html will start going to channel that rustdoc was built with. Nightly will continue going to /nightly; Beta will link to /beta; stable compilers will link to /1.52.1 (or whatever version they were built as). - Cross-crate links from std to core currently go to /nightly unconditionally. They will start going to /1.52.0 on stable channels (but remain the same on nightly channels). - Intra-crate links from std to std (or core to core) currently go to the same URL they are hosted at; they will continue to do so. Notably, this is different from everything else because it can preserve the distinction between /stable and /1.52.0 by using relative links. Note that "links" includes both intra-doc links and rustdoc's own automatically generated hyperlinks. ## Implementation changes - Update the testsuite to allow linking to /beta and /1.52.1 in docs - Use an html_root_url for the standard library that's dependent on the channel This avoids linking to nightly docs on stable. - Update rustdoc to use channel-dependent links for primitives from an unknown crate - Set DOC_RUST_LANG_ORG_CHANNEL from bootstrap to ensure it's in sync - Include doc.rust-lang.org in the channel cc Mark-Simulacrum - I know [you were dubious about this in the past](https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/Rustdoc.20unconditionally.20links.20to.20nightly.20libstd.20docs/near/231223124), but I'm not quite sure why? I see this as "just a bugfix", I don't know why rustdoc should unconditionally link to nightly. cc dtolnay who commented in https://github.com/rust-lang/rust/issues/30693: > I would welcome a PR to solve this permanently if anyone has ideas for how. I don't believe we need an RFC. Fixes https://github.com/rust-lang/rust/issues/30693 (note that issue is marked as feature-accepted, although I don't see where it was discussed).
2021-06-05Rollup merge of #84880 - jyn514:cleanup-itemkind, r=GuillaumeGomezYuki Okushi-20/+33
Make match in `register_res` easier to read - 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? Found while reviewing https://github.com/rust-lang/rust/pull/84176.
2021-06-05Rollup merge of #84466 - jyn514:prim-str, r=GuillaumeGomezYuki Okushi-45/+10
rustdoc: Remove `PrimitiveType::{to_url_str, as_str}` These can easily be rewritten in terms of `as_sym`, and this avoids bugs where the two get out of sync. I don't expect this to have a perf impact, but I'll start a perf run just in case.
2021-06-04Fix `deny(invalid_doc_attributes)`Joshua Nelson-1/+2
2021-06-04rustdoc: link consistently to stable/beta in diagnostic messagesJoshua Nelson-7/+17
2021-06-04rustdoc: link to stable/beta docs consistently in documentationJoshua Nelson-1/+8
## User-facing changes - Intra-doc links to primitives that currently go to rust-lang.org/nightly/std/primitive.x.html will start going to channel that rustdoc was built with. Nightly will continue going to /nightly; Beta will link to /beta; stable compilers will link to /1.52.1 (or whatever version they were built as). - Cross-crate links from std to core currently go to /nightly unconditionally. They will start going to /1.52.0 on stable channels (but remain the same on nightly channels). - Intra-crate links from std to std (or core to core) currently go to the same URL they are hosted at; they will continue to do so. Notably, this is different from everything else because it can preserve the distinction between /stable and /1.52.0 by using relative links. Note that "links" includes both intra-doc links and rustdoc's own automatically generated hyperlinks. ## Implementation changes - Update the testsuite to allow linking to /beta and /1.52.1 in docs - Use an html_root_url for the standard library that's dependent on the channel This avoids linking to nightly docs on stable. - Update rustdoc to use channel-dependent links for primitives from an unknown crate - Set DOC_RUST_LANG_ORG_CHANNEL from bootstrap to ensure it's in sync - Include doc.rust-lang.org in the channel
2021-06-04Auto merge of #85788 - rylev:force-warns, r=nikomatsakisbors-1/+10
Support for force-warns Implements https://github.com/rust-lang/rust/issues/85512. This PR adds a new command line option `force-warns` which will force the provided lints to warn even if they are allowed by some other mechanism such as `#![allow(warnings)]`. Some remaining issues: * https://github.com/rust-lang/rust/issues/85512 mentions that `force-warns` should also be capable of taking lint groups instead of individual lints. This is not implemented. * If a lint has a higher warning level than `warn`, this will cause that lint to warn instead. We probably want to allow the lint to error if it is set to a higher lint and is not allowed somewhere else. * One test is currently ignored because it's not working - when a deny-by-default lint is allowed, it does not currently warn under `force-warns`. I'm not sure why, but I wanted to get this in before the weekend. r? `@nikomatsakis`
2021-06-04Remove `doc(include)`Joshua Nelson-88/+5
2021-06-03rustdoc- Show defaults on const generics Ellen-8/+31
2021-06-03Auto merge of #84834 - GuillaumeGomez:sidebar-unification, r=jshabors-98/+97
Sidebar unification This PR does a few things: * Put crates list at all levels (before, it was only on the "top" items) * Fix bug in module sidebar: the list of items was from the parent module. The other changes (on bootstrap mostly) were to allow to generate multiple crates in a same folder so that we can ensure that clicking on the crates in the sidebar works as expected. I added a rustdoc-gui test to ensure everything is where it should be. r? `@jyn514`
2021-06-02Auto merge of #84703 - GuillaumeGomez:cleanup-dom, r=jshabors-77/+85
Clean up dom The commits come from #84480. They were errors reported by the `tidy` script that we will use to ensure that the HTML generated by rustdoc is valid. I checked carefully that there were no difference so in principle it should be exactly the same rendering but a double-check would be very appreciated in case I missed something. Extra note: `<h4>` and some `<h3>` tags were replaced by `<div>` because they're not supposed to contain tags as they currently do. r? `@jsha`
2021-06-02Replace h3 for notable traits with divGuillaume Gomez-15/+23
2021-06-02Remove data-level selectors from CSS.Jacob Hoffman-Andrews-82/+20
2021-06-02Restrict access to crate_name.Camille GILLOT-2/+3
Also remove original_crate_name, which had the exact same implementation
2021-06-02Force warn on lint groups as wellRyan Levick-1/+10
2021-06-01Don't generate impl-items div container if there is noneGuillaume Gomez-4/+6
2021-06-01Remove invalid usage of aria-levelGuillaume Gomez-25/+25
2021-06-01Replace h3 and h4 containing invalid DOMGuillaume Gomez-48/+107
2021-06-01Add missing <title> in redirection page <head>Guillaume Gomez-0/+1
2021-06-01Replace empty href with "#"Guillaume Gomez-1/+1
2021-06-01Auto merge of #85886 - GuillaumeGomez:rollup-l3yr3np, r=GuillaumeGomezbors-12/+5
Rollup of 4 pull requests Successful merges: - #85473 (fix split-debuginfo error message) - #85622 (Remove toggle for "undocumented items.") - #85826 (Mention "null pointer optimization" in option docs.) - #85860 (Fix details rustdoc toggle for blanket impl) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-06-01Rollup merge of #85860 - pickfire:patch-5, r=GuillaumeGomezGuillaume Gomez-2/+1
Fix details rustdoc toggle for blanket impl In the meantime, allow all of the details to have the same top. Before ![image](https://user-images.githubusercontent.com/4687791/120214139-a673ed00-c266-11eb-9154-3a8148199c8f.png) ![image](https://user-images.githubusercontent.com/4687791/120214232-c5727f00-c266-11eb-8bda-871e6e04819e.png) After ![image](https://user-images.githubusercontent.com/4687791/120214121-9d831b80-c266-11eb-8c33-db1317c42375.png) ![image](https://user-images.githubusercontent.com/4687791/120214273-d4f1c800-c266-11eb-89ee-0f2b7c2e5bdb.png) I stumbled across this while wanting to do a details button for the layout.
2021-06-01Rollup merge of #85622 - jsha:untoggle-undocumented, r=GuillaumeGomezGuillaume Gomez-10/+4
Remove toggle for "undocumented items." Per discussion in #84326. For trait implementations, this was misleading: the items actually do have documentation (but it comes from the trait definition). For both trait implementations and trait implementors, this was redundant: in both of those cases, the items are default-hidden by different toggle at the level above. Update tests: Remove XPath selectors that over-specified on details tag, in cases that weren't testing toggles. Add an explicit test for toggles on methods. Rename item-hide-threshold to toggle-item-contents for consistency. Demo: https://hoffman-andrews.com/rust/untoggle-undocumented/std/string/struct.String.html https://hoffman-andrews.com/rust/untoggle-undocumented/std/io/trait.Read.html
2021-06-01Auto merge of #85884 - rust-lang:revert-85153-qresolve, r=michaelwoeristerbors-3/+2
Revert "Reduce the amount of untracked state in TyCtxt" Reverts rust-lang/rust#85153 Fixes https://github.com/rust-lang/rust/issues/85878 The performance hit is massive, and was not visible in the in-review perf run. r? `@Aaron1011`
2021-06-01Revert "Reduce the amount of untracked state in TyCtxt"Camille Gillot-3/+2
2021-06-01Auto merge of #85859 - pickfire:patch-3, r=CraftSpiderbors-1/+2
Add title for copy to clipboard button in rustdoc This button ![image](https://user-images.githubusercontent.com/4687791/120210874-da4d1380-c262-11eb-9987-9145c4354029.png)
2021-06-01Auto merge of #85153 - cjgillot:qresolve, r=Aaron1011bors-2/+3
Reduce the amount of untracked state in TyCtxt Access to untracked global state may generate instances of #84970. The GlobalCtxt contains the lowered HIR, the resolver outputs and interners. By wrapping the resolver inside a query, we make sure those accesses are properly tracked. As a no_hash query, all dependent queries essentially become `eval_always`, what they should have been from the beginning.
2021-05-31Fix details rustdoc toggle for blanket implIvan Tham-2/+1
In the meantime, allow all of the details to have the same top.
2021-05-31Add title for copy to clipboard button in rustdocIvan Tham-1/+2
2021-05-31Improve display of the separation between page items and siblings in the sidebarGuillaume Gomez-2/+5