about summary refs log tree commit diff
path: root/src/librustdoc/html/render
AgeCommit message (Collapse)AuthorLines
2022-04-01Rollup merge of #95475 - ↵Matthias Krüger-0/+1
Jules-Bertholet:rustdoc-hide-assoc-consts-from-trait-impls, r=jsha rustdoc: Only show associated consts from inherent impls in sidebar Resolves #95459
2022-03-31remove find_use_placementFausto-2/+5
A more robust solution to finding where to place use suggestions was added. The algorithm uses the AST to find the span for the suggestion so we pass this span down to the HIR during lowering and use it. Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-03-30Remove unneeded `to_string` callGuillaume Gomez-1/+1
2022-03-30Only show associated consts from inherent impls in sidebarJules Bertholet-0/+1
2022-03-29Auto merge of #95096 - GuillaumeGomez:rm-header-fn-field, r=camelidbors-14/+15
Remove header field from clean::Function Fixes https://github.com/rust-lang/rust/issues/89673. This is another take on https://github.com/rust-lang/rust/issues/89673 (compared to https://github.com/rust-lang/rust/pull/91217) but very different on the approach: I moved the header call in one place but still require to have the `clean::Item` so I can use the `DefId` to get what is missing. cc `@jyn514` (you reviewed the original so maybe you want to take a look?) r? `@camelid`
2022-03-29Remove header field from clean::FunctionGuillaume Gomez-14/+15
2022-03-27Add scrape examples help pageWill Crichton-5/+43
2022-03-27Fix markdown issue, remove hard-coded rust-lang.org urlWill Crichton-1/+3
2022-03-27Improve alignment of additional scraped examples, add scrape examples help pageWill Crichton-0/+2
2022-03-27Only highlight identifier in scraped examples, not argumentsWill Crichton-29/+4
2022-03-27Improve Rustdoc UI for scraped examples with multiline arguments, fixWill Crichton-3/+29
overflow in line numbers
2022-03-21fix: add a space only in front of 🔒Maximilian Köhl-2/+2
2022-03-21move the 🔒 after the nameMaximilian Köhl-1/+1
2022-03-19apply rustfmtMaximilian Köhl-2/+4
2022-03-19rustdoc: add 🔒 to indicate restricted visibilityMaximilian Köhl-3/+10
2022-03-16resolve the conflict in compiler/rustc_session/src/parse.rscodehorseman-1/+1
Signed-off-by: codehorseman <cricis@yeah.net>
2022-03-14Auto merge of #94139 - est31:let_else_rustdoc, r=notriddlebors-14/+4
librustdoc: adopt let else in more places Continuation of #89933, #91018, #91481, #93046, #93590, #94011. I have extended my clippy lint to also recognize tuple passing and match statements. The diff caused by fixing it is way above 1 thousand lines. Thus, I split it up into multiple pull requests to make reviewing easier. This PR handles librustdoc.
2022-03-12Auto merge of #94733 - nnethercote:fix-AdtDef-interning, r=fee1-deadbors-1/+1
Improve `AdtDef` interning. This commit makes `AdtDef` use `Interned`. Much of the commit is tedious changes to introduce getter functions. The interesting changes are in `compiler/rustc_middle/src/ty/adt.rs`. r? `@fee1-dead`
2022-03-11Collapse Blanket Implementations and Auto-trait implementations by defaultGuillaume Gomez-5/+11
2022-03-11Improve `AdtDef` interning.Nicholas Nethercote-1/+1
This commit makes `AdtDef` use `Interned`. Much the commit is tedious changes to introduce getter functions. The interesting changes are in `compiler/rustc_middle/src/ty/adt.rs`.
2022-03-10Rollup merge of #94740 - GuillaumeGomez:unify-impl-blocks, r=notriddleMatthias Krüger-6/+10
Unify impl blocks by wrapping them into a div The blanket and "auto traits" sections are wrapped into a `div` with an ID. This PR fixes this incoherence by wrapping each impl section (the "deref impl" and the "inherent impl" sections were missing it). It'll also make some tests simpler to write. r? `````@notriddle`````
2022-03-08Unify inherent impl blocks by wrapping them into a divGuillaume Gomez-6/+10
2022-03-07Clarify `Layout` interning.Nicholas Nethercote-5/+5
`Layout` is another type that is sometimes interned, sometimes not, and we always use references to refer to it so we can't take any advantage of the uniqueness properties for hashing or equality checks. This commit renames `Layout` as `LayoutS`, and then introduces a new `Layout` that is a newtype around an `Interned<LayoutS>`. It also interns more layouts than before. Previously layouts within layouts (via the `variants` field) were never interned, but now they are. Hence the lifetime on the new `Layout` type. Unlike other interned types, these ones are in `rustc_target` instead of `rustc_middle`. This reflects the existing structure of the code, which does layout-specific stuff in `rustc_target` while `TyAndLayout` is generic over the `Ty`, allowing the type-specific stuff to occur in `rustc_middle`. The commit also adds a `HashStable` impl for `Interned`, which was needed. It hashes the contents, unlike the `Hash` impl which hashes the pointer.
2022-03-04librustdoc: adopt let else in more placesest31-14/+4
2022-02-27make GATs print properly in traitsMichael Goulet-18/+39
2022-02-27move method out of nestingMichael Goulet-89/+90
2022-02-27Rollup merge of #94417 - GuillaumeGomez:fix-duplicated-impl-links, r=notriddleMatthias Krüger-7/+10
Fix duplicated impl links Fixes #78701. The problem is that the blanket impl has the same ID as the other impl, except that we don't derive IDs when we generate the sidebar. We now do. r? ``@notriddle``
2022-02-27Correctly generate links in the sidebar for implsGuillaume Gomez-7/+10
2022-02-22Prevent generation of infinite redirectionsGuillaume Gomez-26/+34
2022-02-20Rollup merge of #94002 - GuillaumeGomez:duplicated-sidebar-macro, r=notriddleMatthias Krüger-6/+11
rustdoc: Avoid duplicating macros in sidebar Fixes #93912. cc ``````@jsha`````` (for the GUI test) r? ``````@camelid``````
2022-02-17Rollup merge of #94011 - est31:let_else, r=lcnrMatthias Krüger-3/+1
Even more let_else adoptions Continuation of #89933, #91018, #91481, #93046, #93590.
2022-02-16Adopt let_else in even more placesest31-3/+1
2022-02-16Unify sidebar a bit more by generating a list using <ul> instead of <div> ↵Guillaume Gomez-121/+104
elements
2022-02-14Fix macro reexports duplicates in the sidebarGuillaume Gomez-6/+11
2022-02-10Rollup merge of #93830 - camelid:cleanup-section-code, r=GuillaumeGomezMatthias Krüger-81/+171
Refactor sidebar printing code This is the refactoring parts of #92660, plus the trait aliases capitalization consistency fix. I think this will be necessary for #92658. r? `@GuillaumeGomez`
2022-02-09Title-case trait aliases section for consistencyNoah Lev-1/+1
2022-02-09Refactor sidebar printing codeNoah Lev-40/+48
The new code is much simpler and easier to understand. In fact, the old code actually had a subtle bug where it excluded a few item types, including trait aliases, from the sidebar, even though they are rendered on the page itself! Now, all sections should show up in the sidebar.
2022-02-09Deduplicate item sectionsNoah Lev-22/+13
2022-02-09rustdoc: Create enum for sections holding itemsNoah Lev-37/+128
2022-02-09Unify headings indent and remove useless anchorGuillaume Gomez-1/+1
2022-02-04Rollup merge of #93576 - jsha:fix-rustdoc-html, r=GuillaumeGomezMatthias Krüger-35/+27
Emit more valid HTML from rustdoc 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. We can suppress those warnings with flags to tidy, and get a run that returns 0 (success): ``` tidy -o /dev/null -quiet --drop-empty-elements no --warn-proprietary-attributes no build/x86_64-unknown-linux-gnu/doc/std/string/trait.ToString.html ``` Note: this requires the latest version of tidy-html5, built from https://github.com/htacg/tidy-html5. Older versions (including the default version on Ubuntu 21.10) think `<section>` can't occur inside `<summary>`. Demo: https://rustdoc.crud.net/jsha/fix-rustdoc-html/std/string/struct.String.html r? `@GuillaumeGomez`
2022-02-03rustdoc: clippy::complexity fixesMatthias Krüger-1/+1
clippy::map_flatten clippy::clone_on_copy clippy::useless_conversion clippy::needless_arbitrary_self_type
2022-02-02Emit valid HTML from rustdocJacob Hoffman-Andrews-35/+27
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-02Rollup merge of #93420 - jsha:adjust-settings-layout, r=GuillaumeGomezMatthias Krüger-1/+1
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-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-01-31Improve wrapping on settings pageJacob Hoffman-Andrews-1/+1
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-30Auto merge of #92711 - zredb:issue-90187-fix, r=notriddlebors-24/+34
rustdoc: Remove `def_id_no_primitives` Fixes #90187.
2022-01-30Rollup merge of #93391 - notriddle:notriddle/remove-srclink-tooltip, ↵Matthias Krüger-1/+1
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-27rustdoc: remove tooltip from source linkMichael Howell-1/+1
This made more sense back when it was abbreviated, but now it seems redundant.
2022-01-25Fix invalid extra dot after version if no sourceGuillaume Gomez-3/+4