about summary refs log tree commit diff
path: root/src/librustdoc
AgeCommit message (Collapse)AuthorLines
2022-02-04Rollup merge of #90132 - joshtriplett:stabilize-instrument-coverage, ↵Matthias Krüger-2/+2
r=wesleywiser Stabilize `-Z instrument-coverage` as `-C instrument-coverage` (Tracking issue for `instrument-coverage`: https://github.com/rust-lang/rust/issues/79121) This PR stabilizes support for instrumentation-based code coverage, previously provided via the `-Z instrument-coverage` option. (Continue supporting `-Z instrument-coverage` for compatibility for now, but show a deprecation warning for it.) Many, many people have tested this support, and there are numerous reports of it working as expected. Move the documentation from the unstable book to stable rustc documentation. Update uses and documentation to use the `-C` option. Addressing questions raised in the tracking issue: > If/when stabilized, will the compiler flag be updated to -C instrument-coverage? (If so, the -Z variant could also be supported for some time, to ease migrations for existing users and scripts.) This stabilization PR updates the option to `-C` and keeps the `-Z` variant to ease migration. > The Rust coverage implementation depends on (and automatically turns on) -Z symbol-mangling-version=v0. Will stabilizing this feature depend on stabilizing v0 symbol-mangling first? If so, what is the current status and timeline? This stabilization PR depends on https://github.com/rust-lang/rust/pull/90128 , which stabilizes `-C symbol-mangling-version=v0` (but does not change the default symbol-mangling-version). > The Rust coverage implementation implements the latest version of LLVM's Coverage Mapping Format (version 4), which forces a dependency on LLVM 11 or later. A compiler error is generated if attempting to compile with coverage, and using an older version of LLVM. Given that LLVM 13 has now been released, requiring LLVM 11 for coverage support seems like a reasonable requirement. If people don't have at least LLVM 11, nothing else breaks; they just can't use coverage support. Given that coverage support currently requires a nightly compiler and LLVM 11 or newer, allowing it on a stable compiler built with LLVM 11 or newer seems like an improvement. The [tracking issue](https://github.com/rust-lang/rust/issues/79121) and the [issue label A-code-coverage](https://github.com/rust-lang/rust/labels/A-code-coverage) link to a few open issues related to `instrument-coverage`, but none of them seem like showstoppers. All of them seem like improvements and refinements we can make after stabilization. The original `-Z instrument-coverage` support went through a compiler-team MCP at https://github.com/rust-lang/compiler-team/issues/278 . Based on that, `@pnkfelix` suggested that this needed a stabilization PR and a compiler-team FCP.
2022-02-04rustdoc: Collect traits in scope for foreign inherent implsVadim Petrochenkov-0/+7
2022-02-04Rollup merge of #93638 - notriddle:notriddle/unused-hash, r=GuillaumeGomezMatthias Krüger-1/+1
rustdoc: remove unused Hash impl
2022-02-04Rollup merge of #93632 - matthiaskrgr:rustdoclippy2, r=GuillaumeGomezMatthias Krüger-13/+7
rustdoc: clippy::complexity fixes clippy::map_flatten clippy::clone_on_copy clippy::useless_conversion clippy::needless_arbitrary_self_type
2022-02-04Rollup merge of #92735 - GuillaumeGomez:crate-filter-url-param, r=jshaMatthias Krüger-58/+108
Add crate filter parameter in URL Fixes #92621. r? `@jsha`
2022-02-03rustdoc: remove unused Hash implMichael Howell-1/+1
2022-02-03rustdoc: clippy::complexity fixesMatthias Krüger-13/+7
clippy::map_flatten clippy::clone_on_copy clippy::useless_conversion clippy::needless_arbitrary_self_type
2022-02-03Add filter-crate URL parameterGuillaume Gomez-47/+97
2022-02-03Remove defaultness from ImplItem.Camille GILLOT-1/+2
2022-02-02Unify storage getter and setter functionsGuillaume Gomez-12/+12
2022-02-02Rollup merge of #93542 - GuillaumeGomez:lifetime-elision, r=oli-obkMatthias Krüger-3/+13
Prevent lifetime elision in type alias Fixes #93401. Apparently, the problem has been fixed in the compiler. r? `@oli-obk`
2022-02-02Lazily resolve type-alias-impl-trait defining usesOli Scherer-0/+1
by using an opaque type obligation to bubble up comparisons between opaque types and other types Also uses proper obligation causes so that the body id works, because out of some reason nll uses body ids for logic instead of just diagnostics.
2022-02-02Emit valid HTML from rustdocJacob Hoffman-Andrews-35/+28
Previously, tidy-html5 (`tidy`) would complain about a few things in our HTML. The main thing is that `<summary>` tags can't contain `<div>`s. That's easily fixed by changing out the `<div>`s for `<span>`s with `display: block`. However, there's also a rule that `<span>`s can't contain heading elements. `<span>` permits only "phrasing content" https://developer.mozilla.org/en-US/docs/Web/HTML/Element/span, and `<h3>` (and friends) are "Flow content, heading content, palpable content". https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Heading_Elements We have a wrapping `<div>` that goes around each `<h3>`/`<h4>`, etc. We turn that into a `<section>` rather than a `<span>` because `<section>` permits "flow content". https://developer.mozilla.org/en-US/docs/Web/HTML/Element/section After this change we get only three warnings from tidy, run on struct.String.html: line 6 column 10790 - Warning: trimming empty <span> line 1 column 1118 - Warning: <link> proprietary attribute "disabled" line 1 column 1193 - Warning: <link> proprietary attribute "disabled" The empty `<span>` is a known issue - there's a span in front of the search box to work around a strange Safari issue. The `<link>` attributes are the non-default stylesheets. We can probably refactor theme application to avoid using this proprietary "disabled" attribute.
2022-02-01Use multipart suggestion for code wrappingMichael Howell-17/+10
Another one of those "good grief, I just submitted it and NOW I think of it" moments.
2022-02-02Rollup merge of #93420 - jsha:adjust-settings-layout, r=GuillaumeGomezMatthias Krüger-8/+10
Improve wrapping on settings page Previously, the radio button choices for themes would wrap awkwardly on narrow screens. With this change, the group of choices will prefer bumping down to the next line together, leaving the setting name on its own line. Also fix some minor spacing issues: - Align the setting name vertically with the radio button choices. - Use margin instead of padding for most spacing choices. - Use no margin/padding on the right-hand side. Demo: https://rustdoc.crud.net/jsha/adjust-settings-layout/settings.html r? ``@GuillaumeGomez`` Before (narrow screen): ![image](https://user-images.githubusercontent.com/220205/151555533-7ab65216-d178-4dcc-8792-3c8fb9da8718.png) After (narrow screen): ![image](https://user-images.githubusercontent.com/220205/151555702-ad79af32-f84b-4ee4-ae7a-1a2a463c0f6f.png)
2022-02-01Fix unicode slicing bugMichael Howell-3/+3
2022-02-01In retrospect, MachineApplicable is probably too confidentMichael Howell-1/+1
2022-02-01rustdoc: correct unclosed HTML tags as genericsMichael Howell-9/+73
2022-02-01Include all contents of first line of scraped itemWill Crichton-1/+4
2022-02-01Remove "up here" arrow on item-infosJacob Hoffman-Andrews-20/+24
Use spacing to distinguish what is related to a given heading.
2022-02-01librustdoc: render: use render_into instead of creating a temp stringMuhammad Falak R Wani-2/+1
Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
2022-02-01librustdoc: inline and forward all methods for `impl Write for Buffer`Muhammad Falak R Wani-0/+11
Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
2022-02-01librustdoc: impl core::fmt::Write for rustdoc::html::render::BufferMuhammad Falak R Wani-0/+6
Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
2022-02-01Fix lifetime elision in type aliasesGuillaume Gomez-3/+13
2022-01-31Improve wrapping on settings pageJacob Hoffman-Andrews-8/+10
Previously, the radio button choices for themes would wrap awkwardly on narrow screens. With this change, the group of choices will prefer bumping down to the next line together, leaving the setting name on its own line. Also fix some minor spacing issues: - Align the setting name vertically with the radio button choices. - Use margin instead of padding for most spacing choices. - Use no margin/padding on the right-hand side.
2022-01-31Rollup merge of #93444 - camelid:rustdoc-css-cleanup, r=GuillaumeGomez,jshaMatthias Krüger-7/+8
Fix some CSS warnings and errors from VS Code There's no such CSS rule as `box-shadow-color`, so I instead copied the whole `box-shadow` property to each rule to make it actually apply. r? `@jsha`
2022-01-30Auto merge of #92711 - zredb:issue-90187-fix, r=notriddlebors-49/+51
rustdoc: Remove `def_id_no_primitives` Fixes #90187.
2022-01-30Rollup merge of #93183 - jsha:mobile-nav-fixes, r=GuillaumeGomezEric Huss-3/+16
rustdoc: mobile nav fixes - Make sure the mobile-topbar doesn't overflow its height if the user sets a bigger font. - Make sure the sidebar can be scrolled all the way to the bottom by shortening it to accommodate the mobile-topbar. - Make the item name in the mobile-topbar clickable to go to the top of the page. - Remove excess padding sidebar in mobile mode. Demo https://rustdoc.crud.net/jsha/mobile-nav-fixes/std/string/struct.String.html r? `@GuillaumeGomez`
2022-01-30Rollup merge of #92908 - dtolnay:rustdoc, r=GuillaumeGomezEric Huss-53/+242
Render more readable macro matcher tokens in rustdoc Follow-up to #92334. This PR lifts some of the token rendering logic from https://github.com/dtolnay/prettyplease into rustdoc so that even the matchers for which a source code snippet is not available (because they are macro-generated, or any other reason) follow some baseline good assumptions about where the tokens in the macro matcher are appropriate to space. The below screenshots show an example of the difference using one of the gnarliest macros I could find. Some things to notice: - In the **before**, notice how a couple places break in between `$(....)`↵`*`, which is just about the worst possible place that it could break. - In the **before**, the lines that wrapped are weirdly indented by 1 space of indentation relative to column 0. In the **after**, we use the typical way of block indenting in Rust syntax which is put the open/close delimiters on their own line and indent their contents by 4 spaces relative to the previous line (so 8 spaces relative to column 0, because the matcher itself is indented by 4 relative to the `macro_rules` header). - In the **after**, macro_rules metavariables like `$tokens:tt` are kept together, which is how just about everybody writing Rust today writes them. ## Before ![Screenshot from 2022-01-14 13-05-53](https://user-images.githubusercontent.com/1940490/149585105-1f182b78-751f-421f-a234-9dbc04fa3bbd.png) ## After ![Screenshot from 2022-01-14 13-06-04](https://user-images.githubusercontent.com/1940490/149585118-d4b52ea7-3e67-4b6e-a12b-31dfb8172f86.png) r? `@camelid`
2022-01-29rustdoc: small fixes to mobile navigationJacob Hoffman-Andrews-3/+16
- Make sure the mobile-topbar doesn't overflow its height if the user sets a bigger font. - Make sure the sidebar can be scrolled all the way to the bottom by shortening it to accommodate the mobile-topbar. - Make the item name in the mobile-topbar clickable to go to the top of the page. - Remove excess padding sidebar in mobile mode.
2022-01-30Rollup merge of #93441 - ↵Matthias Krüger-0/+11
notriddle:notriddle/collect-crate-doc-links-very-early, r=petrochenkov rustdoc: load the set of in-scope traits for modules with no docstring Fixes #93428 This fix is a response to a couple of special cases related to the `module_id`, which is eventually used for trait candidates: * The module id is always set to the current crate, when checking `crate::`. Normally, the set of in-scope traits would be set in `load_links_in_attrs`, but if there are no doc comments, then that loop will never run. * the module id is set to the parent module, when resolving a module that is spelled like this: // Notice how we use an outlined doc comment here! // [`Test::my_fn`] mod something { } As with the above problem with `crate::`, we need to make sure the module gets its traits in scope resolved, even if it has no doc comments of its own.
2022-01-30Rollup merge of #93391 - notriddle:notriddle/remove-srclink-tooltip, ↵Matthias Krüger-2/+2
r=jsha,GuillaumeGomez rustdoc: remove tooltip from source link This made more sense back when it was abbreviated, but now it seems redundant.
2022-01-29Fix some CSS warnings and errors from VS CodeNoah Lev-7/+8
There's no such CSS rule as `box-shadow-color`, so I instead copied the whole `box-shadow` property to each rule to make it actually apply.
2022-01-29Rollup merge of #93299 - GuillaumeGomez:dot-separator-no-source, r=jshaMatthias Krüger-3/+4
Fix dot separator when there is no source link Fixes #92973. We did well adding this test since there was a bug: ![Screenshot from 2022-01-25 17-05-48](https://user-images.githubusercontent.com/3050060/151016535-39b45f52-e1e0-4963-ad19-532e24ec4c9b.png) r? `@jsha`
2022-01-28rustdoc: load the set of in-scope traits for modules with no docstringMichael Howell-0/+11
Fixes #93428 This fix is a response to a couple of special cases related to the `module_id`, which is eventually used for trait candidates: * The module id is always set to the current crate, when checking `crate::`. Normally, the set of in-scope traits would be set in `load_links_in_attrs`, but if there are no doc comments, then that loop will never run. * the module id is set to the parent module, when resolving a module that is spelled like this: // Notice how we use an outlined doc comment here! // [`Test::my_fn`] mod something { } As with the above problem with `crate::`, we need to make sure the module gets its traits in scope resolved, even if it has no doc comments of its own.
2022-01-28Same code for ty and hir impl itemsRune Tynan-16/+16
2022-01-28Remove now-unnecessary blanket impl HIR checkRune Tynan-22/+5
2022-01-28Set visibility to inherited in trait impls to match HIRRune Tynan-1/+10
2022-01-28add allow_fail field in TestDesc to pass checkyuhaixin.hx-0/+2
2022-01-28remove allow_fail test flagyuhaixin.hx-14/+0
2022-01-28Remove extra empty doc lineGuillaume Gomez-1/+0
2022-01-27rustdoc: remove tooltip from source linkMichael Howell-2/+2
This made more sense back when it was abbreviated, but now it seems redundant.
2022-01-26Convert empty tuple to DefaultReturn in ty pathRune Tynan-1/+8
2022-01-26Don't use is_local to determine function cleaning method call intentRune Tynan-6/+5
2022-01-26Rollup merge of #93338 - GuillaumeGomez:update-minifier, r=notriddleMatthias Krüger-1/+1
Update minifier crate version to 0.0.42 Some issues on the CSS minification. r? `@notriddle`
2022-01-26Update minifier crate version to 0.0.42Guillaume Gomez-1/+1
2022-01-26Auto merge of #88679 - petrochenkov:doctrscope, r=GuillaumeGomezbors-33/+108
rustdoc: Pre-calculate traits that are in scope for doc links This eliminates one more late use of resolver (part of #83761). At early doc link resolution time we go through parent modules of items from the current crate, reexports of items from other crates, trait items, and impl items collected by `collect-intra-doc-links` pass, determine traits that are in scope in each such module, and put those traits into a map used by later rustdoc passes. r? `@jyn514`
2022-01-25Rollup merge of #93291 - conradludgate:minor-fix-93231, r=GuillaumeGomezMatthias Krüger-1/+1
minor fix for #93231 In #93231 I introduced the new sidebar colours to make the contrast more balanced and easier to read, but it seems I made a copy-paste error in the light theme, resulting in functions appearing green. This one line change replaces that colour with it's corrected orange/brown colour. I have double checked the rest of the colours and they seem ok. Sorry for the inconvenience
2022-01-25Rollup merge of #93286 - jsha:sidebar-nowrap, r=GuillaumeGomezMatthias Krüger-0/+4
Add white-space: nowrap to links in the sidebar We already have overflow: hidden on these links, but if there is a possibility to wrap, they will wrap. This happens in particular for trait implementations because the punctuation (`<>, `) introduces opportunities for breaks. That produces inconsistent UI. Fix it by forcing them not to wrap. Demo: https://rustdoc.crud.net/jsha/sidebar-nowrap/std/string/struct.String.html To see the effect, scroll down to the "Trait Implementations" portion of the sidebar and look at IndexMut. Compare vs: https://doc.rust-lang.org/std/string/struct.String.html https://doc.rust-lang.org/nightly/std/string/struct.String.html r? `@camelid`
2022-01-25Auto merge of #93095 - Aaron1011:remove-assoc-ident, r=cjgillotbors-7/+6
Store a `Symbol` instead of an `Ident` in `AssocItem` This is the same idea as #92533, but for `AssocItem` instead of `VariantDef`/`FieldDef`. With this change, we no longer have any uses of `#[stable_hasher(project(...))]`