about summary refs log tree commit diff
path: root/src/librustdoc/html
AgeCommit message (Collapse)AuthorLines
2022-03-10Rollup merge of #93950 - T-O-R-U-S:use-modern-formatting-for-format!-macros, ↵Dylan DPC-1/+1
r=Mark-Simulacrum Use modern formatting for format! macros This updates the standard library's documentation to use the new format_args syntax. The documentation is worthwhile to update as it should be more idiomatic (particularly for features like this, which are nice for users to get acquainted with). The general codebase is likely more hassle than benefit to update: it'll hurt git blame, and generally updates can be done by folks updating the code if (and when) that makes things more readable with the new format. A few places in the compiler and library code are updated (mostly just due to already having been done when this commit was first authored). `eprintln!("{}", e)` becomes `eprintln!("{e}")`, but `eprintln!("{}", e.kind())` remains untouched.
2022-03-10Rollup merge of #94740 - GuillaumeGomez:unify-impl-blocks, r=notriddleMatthias Krüger-7/+12
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-10Use implicit capture syntax in format_argsT-O-R-U-S-1/+1
This updates the standard library's documentation to use the new syntax. The documentation is worthwhile to update as it should be more idiomatic (particularly for features like this, which are nice for users to get acquainted with). The general codebase is likely more hassle than benefit to update: it'll hurt git blame, and generally updates can be done by folks updating the code if (and when) that makes things more readable with the new format. A few places in the compiler and library code are updated (mostly just due to already having been done when this commit was first authored).
2022-03-08Unify inherent impl blocks by wrapping them into a divGuillaume Gomez-7/+12
2022-03-07Auto merge of #94706 - matthiaskrgr:rollup-l5erynr, r=matthiaskrgrbors-8/+5
Rollup of 4 pull requests Successful merges: - #93350 (libunwind: readd link attrs to _Unwind_Backtrace) - #93827 (Stabilize const_fn_fn_ptr_basics, const_fn_trait_bound, and const_impl_trait) - #94696 (Remove whitespaces and use CSS to align line numbers to the right instead) - #94700 (rustdoc: Update minifier version) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-03-07Remove unneeded whitespace generation and use CSS instead instead to align ↵Guillaume Gomez-8/+5
line numbers to the right
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-06Rollup merge of #93412 - fee1-dead:improve-rustdoc-const-bounds, ↵Matthias Krüger-72/+85
r=GuillaumeGomez Improve rustdoc const bounds - Rustdoc no longer displays `~const` in trait bounds, because it currently means nothing for stable users, and because we still haven't decided on the final syntax yet. - Rustdoc will hide trait bounds where the trait is `Drop` AND it is `~const`, i.e. `~const Drop` bounds because it has no effect on stable users as well. - Because of additional logic that hides the whole `where` statement where it consists of `~const Drop` bounds (so it doesn't display `struct Foo<T>() where ;` like that), bounds that have no trait e.g. `where [T; N+1]: ;` are also hidden. Cherry-picked from #92433.
2022-03-05Rollup merge of #94642 - GuillaumeGomez:source-code-scroll, r=UrgauRalf Jung-9/+7
Fix source code pages scroll To reproduce the bug, go to https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_ast/ast.rs.html#537-541 and click on the `Path` link. The page won't scroll to the content. r? `@Urgau`
2022-03-05Scroll when the anchor change and is linking outside of the displayed contentGuillaume Gomez-9/+7
2022-03-04librustdoc: adopt let else in more placesest31-24/+10
2022-03-04Auto merge of #94588 - Dylan-DPC:rollup-7pxd0i3, r=Dylan-DPCbors-1/+1
Rollup of 10 pull requests Successful merges: - #88805 (Clarification of default socket flags) - #93418 (rustdoc & doc: no `shortcut` for `rel="icon"`) - #93913 (Remove the everybody loops pass) - #93965 (Make regular stdio lock() return 'static handles) - #94339 (ARM: Only allow using d16-d31 with asm! when supported by the target) - #94404 (Make Ord and PartialOrd opt-out in `newtype_index`) - #94466 (bootstrap: correct reading of flags for llvm) - #94572 (Use `HandleOrNull` and `HandleOrInvalid` in the Windows FFI bindings.) - #94575 (CTFE SwitchInt: update comment) - #94582 (Fix a bug in `x.py fmt` that prevents some files being formatted.) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-03-04Rollup merge of #93418 - ojeda:no-shortcut, r=camelidDylan DPC-1/+1
rustdoc & doc: no `shortcut` for `rel="icon"` According to https://html.spec.whatwg.org/multipage/links.html#rel-icon: > For historical reasons, the `icon` keyword may be preceded by the keyword "`shortcut`". And to https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types: > **Warning:** The `shortcut` link type is often seen before `icon`, but this link type is non-conforming, ignored and **web authors must not use it anymore.** While it was removed from the Rust logo case a while ago in commit 085679c ("Use theme-adaptive SVG favicon from other Rust sites"), it is still there for the custom logo case. Also updated a few other instances. Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2022-03-03make generic projection types print correctlyMichael Goulet-5/+11
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-24Fix bad handling of the source code viewer sidebar style to prevent the ↵Guillaume Gomez-3/+3
appearance of the logo
2022-02-23rustdoc: write directly to buffer in `inner_full_print`Michael Howell-27/+19
This change avoids several temporary allocations for every argument.
2022-02-22Prevent generation of infinite redirectionsGuillaume Gomez-26/+34
2022-02-22Address review commentsDeadbeef-10/+10
2022-02-22Bless rustdoc testDeadbeef-84/+82
2022-02-22Do not display hidden `~const Drop` boundsDeadbeef-5/+19
2022-02-22Do not display ~const in rustdocDeadbeef-1/+2
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-6/+2
Even more let_else adoptions Continuation of #89933, #91018, #91481, #93046, #93590.
2022-02-17Rollup merge of #93780 - GuillaumeGomez:links-in-sidebar, r=jshaMatthias Krüger-127/+109
Generate list instead of div items in sidebar Fixes #92986. Surprisingly, we didn't have much CSS for this... [Demo](https://rustdoc.crud.net/imperio/links-in-sidebar/std/index.html). r? `@jsha`
2022-02-16Adopt let_else in even more placesest31-6/+2
2022-02-16Unify sidebar a bit more by generating a list using <ul> instead of <div> ↵Guillaume Gomez-127/+109
elements
2022-02-16Rollup merge of #93382 - GuillaumeGomez:search-input-padding, r=jshaMatthias Krüger-1/+1
Add a bit more padding in search box As asked in https://github.com/rust-lang/rust/pull/93113#issuecomment-1021565703, here is a bit more padding. You can check it [here](https://rustdoc.crud.net/imperio/search-input-padding/foo/index.html). r? `@camelid`
2022-02-14Fix macro reexports duplicates in the sidebarGuillaume Gomez-6/+11
2022-02-13Auto merge of #93763 - jsha:re-space-empty-impls, r=GuillaumeGomezbors-2/+3
rustdoc: fix spacing of non-toggled impl blocks We [recently removed the "up here" arrows on item-infos](https://github.com/rust-lang/rust/pull/92651), and adjusted vertical spacing so that even without the arrow, it would be visually clear which item the item-info belonged to. The new CSS styles for vertical spacing only applied to toggles, though. This missed non-toggled impl blocks - for instance, those without any methods, like https://doc.rust-lang.org/nightly/std/marker/trait.Send.html#implementors. The result was lists of implementors that were spaced too closely. This PR fixes the spacing by making it apply to non-toggled impl blocks as well. This also fixes an issue where item-infos were displayed too far below their items. That was a result of display: table on .item-info .stab. Changed that to display: inline-block. Demo: https://rustdoc.crud.net/jsha/re-space-empty-impls/std/marker/trait.Send.html Before: <img width=300 src="https://user-images.githubusercontent.com/220205/152954394-ec0b80e7-2573-4f06-9d7a-7b10b8ceac60.png"> After: <img width=300 src="https://user-images.githubusercontent.com/220205/152954228-abac1d30-a76d-4ab1-89ec-ef7549fe8c9c.png"> r? `@GuillaumeGomez`
2022-02-11Rollup merge of #93852 - GuillaumeGomez:remove-multi-query, r=jshaMatthias Krüger-97/+6
rustdoc: remove support for multi-query search This is needed by https://github.com/rust-lang/rust/pull/90630 to make feature changes non-existent. cc `@camelid` r? `@jsha`
2022-02-10Remove support for multi-query searchGuillaume Gomez-97/+6
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-09rustdoc: fix spacing of non-toggled impl blocksJacob Hoffman-Andrews-2/+3
We recently removed the "up here" arrows on item-infos, and adjusted vertical spacing so that even without the arrow, it would be visually clear which item the item-info belonged to. The new CSS styles for vertical spacing only applied to toggles, though. This missed non-toggled impl blocks - for instance, those without any methods, like https://doc.rust-lang.org/nightly/std/marker/trait.Send.html#implementors. The result was lists of implementors that were spaced too closely. This PR fixes the spacing by making it apply to non-toggled impl blocks as well. This also fixes an issue where item-infos were displayed too far below their items. That was a result of display: table on .item-info .stab. Changed that to display: inline-block.
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-09Update rustdoc tests for headings indentGuillaume Gomez-34/+7
2022-02-09Unify headings indent and remove useless anchorGuillaume Gomez-33/+12
2022-02-09Add a bit more padding on search padding and reduce its font sizeGuillaume Gomez-1/+1
2022-02-08rustdoc: tweak line and ¶ spacing for a11yJacob Hoffman-Andrews-60/+52
The W3C Web Content Accessibility Guidelines specify a minimum line spacing of 1.5 and a minimum paragraph spacing of 1.5 times the line spacing. Our current line spacing (implemented by line-height) is 1.4, so it's a small bump to go up to 1.5. Similarly, we have a paragraph spacing of 0.6em. Bump that to 0.75em (which is 1.5 times the 0.5em distance between lines). Also, fix all the font sizes so instead of being round-ish numbers in rem (like 1.1rem, 1.2rem), they are round numbers in pixels. Ensure each font size is at least 2 pixels different than the nearest other font size, so distinctions can be clearly seen. Overall the font-sizes are mostly staying the same, being rounded up or down as appropriate. Remove a few unused styles. Simplify the display of the mobile-topbar location, by setting its margins to auto rather than trying to size it exactly to the topbar.
2022-02-07Fix hover effects in sidebarJacob Hoffman-Andrews-33/+18
The dark and ayu themes have a menu-like highlight on sidebar items. The light theme used to, but it was accidentally lost in the sidebar unification. The change brings back the hover effect in the light theme. It also makes the hover effect apply consistently to all links in the sidebar, including headings. It also simplifies the "In _path_" heading so it's one big link. The breadcrumbs are still readily available at the top of the page.
2022-02-07Rollup merge of #93673 - jsha:linkify-sidebar-headings, r=GuillaumeGomezMara Bos-18/+25
Linkify sidebar headings for sibling items Also adjust CSS so this doesn't produce excess padding/margin. Note: I tried and failed to write a test with browser-UI-test. First I tried to `assert-property: (".block.mod h3 a", {"href": "index.html#macros"})`. But the `href` that gets read out is the fully-quallified URL, starting with `file:///`. That URL will differ depending on what path the test is run from, so that doesn't work. Next I tried clicking on the appropriate sidebar link, and verifying that the appropriate heading on the next page is highlighted with the right background color. However, that also didn't work: according to browser-UI-test, the targeted heading was plain white. However, running with no-headless, I could see that it actually was yellow. I suspect this is a bug in the older version of Chromium used with browser-UI-test's bundled puppeteer, since it doesn't reproduce on latest Chrome. Fixes #92957 Demo: https://rustdoc.crud.net/jsha/linkify-sidebar-headings/std/string/trait.ToString.html r? ``@GuillaumeGomez``
2022-02-07Rollup merge of #93416 - name1e5s:chore/remove_allow_fail, r=m-ou-seMara Bos-13/+0
remove `allow_fail` test flag close #93345
2022-02-05Linkify sidebar headings for sibling itemsJacob Hoffman-Andrews-18/+25
Also adjust CSS so this doesn't produce excess padding/margin.
2022-02-06Rollup merge of #93659 - UltiRequiem:refactor_conditional_static_rustdoc, ↵Matthias Krüger-5/+2
r=GuillaumeGomez Refactor conditional Merge two `if` in just one.