1
Fork 0
Commit graph

256 commits

Author SHA1 Message Date
Justus K
45d3daece3
rustdoc: Store DefId's in ItemId on heap for decreasing Item's size 2021-07-05 19:51:51 +02:00
Justus K
acd4dc2d0c
rustdoc: Rename expect_real to expect_def_id, remove Item::is_fake 2021-07-05 19:49:48 +02:00
Justus K
43e1cdbaf9
rustdoc: Replace FakeDefId with new ItemId type 2021-07-05 19:49:43 +02:00
Michael Howell
cedd2425b6 fix(rustdoc): generics search
This commit adds a test case for generics, re-adds generics data
to the search index, and tweaks function indexing to use less space in JSON.

This reverts commit 14ca89446c.
2021-07-01 06:40:27 -07:00
Yuki Okushi
daa87adc4e
Rollup merge of #86608 - notriddle:notriddle/cleanup-rustdoc, r=jyn514
chore(rustdoc): remove unused members of RenderType

PR #86561 removes the only place the `generics` member is read. This PR does even more cleanup.
2021-06-26 00:42:13 +09:00
Michael Howell
14ca89446c chore(rustdoc): remove unused members of RenderType
Commit e629381653 removes the only place
these members variables are actually read.
2021-06-24 16:37:03 -07:00
Stefan Schindler
94c84bd72a Migrate from custom elements to divs with classes to be compatible with safari 2021-06-24 16:46:15 +02:00
Stefan Schindler
cc9ef7d8a8 Hide Crate Version on narrow Screens 2021-06-24 16:46:15 +02:00
Yuki Okushi
2322097ef4
Rollup merge of #86561 - notriddle:notriddle/cleanup-rustdoc, r=jyn514
chore(rustdoc): Remove unused impl block
2021-06-24 13:47:38 +09:00
Jacob Hoffman-Andrews
093e246445 Revert "List trait impls before methods from deref in the sidebar of Rustdoc's output"
This reverts commit 8a058926ec.
2021-06-22 18:18:54 -07:00
Michael Howell
e629381653 chore(rustdoc): Remove unused impl block 2021-06-22 16:41:34 -07:00
Deadbeef
5fb27bca6c
Check for const_unstable before printing const 2021-06-21 19:06:21 +08:00
Deadbeef
9c495b30ef
"(const: unstable)" for stable-but-const-unstable 2021-06-20 08:13:23 +08:00
bors
966361fe49 Auto merge of #86322 - trinity-1686a:rustdoc-fix-overflow-recursive-deref, r=jyn514
fix rustdoc stack overflow on mutually recursive Deref

fix #85095
fix #85037
2021-06-18 07:49:41 +00:00
Jacob Hoffman-Andrews
2ac5c1721a Fix target highlighting in rustdoc.
Also factor out outer_version and const_outer_version into
render_rightside.
2021-06-16 22:48:23 -07:00
Jacob Hoffman-Andrews
c4fa6d5827 Move anchor earlier in the DOM for easier layout 2021-06-16 22:47:46 -07:00
Jacob Hoffman-Andrews
5de1391b88 Factor out render_rightside
This covers rendering of stability_since and the srclink across methods
and trait implementations, so their DOM representation is consistent.
2021-06-16 22:46:53 -07:00
Jacob Hoffman-Andrews
593d6d1cb1 Make portability part of the summary.
That means it will be visible under "Implementors" on trait pages, and
under "Implementations" on struct/enum pages, even when all methods are
collapsed.

Switch to a float layout for rightside elements.
2021-06-16 22:20:25 -07:00
Jacob Hoffman-Andrews
bff4f073c8 Use render_impl_summary when rendering traits. 2021-06-16 22:08:44 -07:00
Jacob Hoffman-Andrews
ce6472987d Remove methods under Implementors on trait pages
These were hidden by default, and duplicated information already on the
page anyhow.

Also remove the "Auto-hide trait implementors of a trait" setting,
which is not needed anymore.
2021-06-16 22:08:36 -07:00
Jacob Hoffman-Andrews
62658bfc22 Open trait implementations' toggles by default.
This makes it possible to use Ctrl-F to find methods defined in traits.
2021-06-16 10:24:59 -07:00
Trinity Pointard
2d76d44eae remove code for recursive Deref in sidebar
fix #85037
2021-06-15 14:30:14 +02:00
Trinity Pointard
aee50f417f fix rustdoc stack overflow on mutually recursive Deref
fix #85095
2021-06-15 11:47:17 +02:00
Yuki Okushi
d921055a5e
Rollup merge of #86277 - jsha:remove-must-use, r=Manishearth
Remove must_use from ALLOWED_ATTRIBUTES

This is a fairly common attribute on methods, but is not something you need to know when reading the method docs - the purpose of the attribute is for the compiler to tell you about it if you forget to use a value.

Removing reclaims some valuable space in the summary of methods, particularly when the attribute has a long string value.

As discussed in #84309. Partially addresses #81482.

r? ```@Manishearth```
2021-06-15 17:40:12 +09:00
bors
d74b36ea2f Auto merge of #84867 - pnkfelix:rustdoc-revert-deref-recur, r=jyn514
rustdoc: revert deref recur to resume inclusion of impl ExtTrait<Local> for ExtType

As discussed here: https://github.com/rust-lang/rust/issues/82465#issuecomment-829290384, Revert PR #80653 to resolve issue #82465.

Issue #82465 was we had stopped including certain trait implementations, namely implementations on an imported type of an imported trait *instantiated on a local type*. That bug was injected by PR #80653.

Reverting #80653 means we don't list all the methods that you have accessible via recursively applying `Deref`.

[Discussion in last week's rustc triage meeting](https://zulip-archive.rust-lang.org/238009tcompilermeetings/19557weekly2021042954818.html#236680594) led us to conclude that the bug was worse than the enhancement, and there was not an obvious fix for the bug itself. So for the short term we  remove the enhancement, while in the long term we will work on figuring out a way to have our imported trait implementation cake and eat it too.
2021-06-15 00:13:53 +00:00
Jacob Hoffman-Andrews
74e8e7bb60 Remove must_use from ALLOWED_ATTRIBUTES
This is a fairly common attribute on methods, but is not something you
need to know when reading the method docs - the purpose of the attribute
is for the compiler to tell you about it if you forget to use a value.

Removing reclaims some valuable space in the summary of methods.
2021-06-13 17:57:16 -07:00
Felix S. Klock II
0deba5546d manually crafted revert of PR #80653, to address issue #82465.
(update: placated tidy)
(update: rebased post PR #84707 )

merge me
2021-06-10 09:48:58 +00:00
Jacob Hoffman-Andrews
1c0ecd41ad Refactor: Extract render_summary from render_impl.
This allows for a more readable straight-through logic in render_impl
without need for a closure.
2021-06-07 21:40:56 -07:00
Guillaume Gomez
e078e56112 Fix invalid ID value in all.html file 2021-06-05 23:14:12 +02:00
bors
19579c6564 Auto merge of #84834 - GuillaumeGomez:sidebar-unification, r=jsha
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-03 02:31:44 +00:00
Jacob Hoffman-Andrews
fab6814ff3 Remove data-level selectors from CSS. 2021-06-02 20:30:17 +02:00
Guillaume Gomez
98a9b02e92 Don't generate impl-items div container if there is none 2021-06-01 21:36:03 +02:00
Guillaume Gomez
93389b5568 Remove invalid usage of aria-level 2021-06-01 21:19:28 +02:00
Guillaume Gomez
9077d540da Replace h3 and h4 containing invalid DOM 2021-06-01 21:19:28 +02:00
Guillaume Gomez
085691b137
Rollup merge of #85622 - jsha:untoggle-undocumented, r=GuillaumeGomez
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-01 11:29:43 +02:00
Guillaume Gomez
9b637fa72e Improve display of the separation between page items and siblings in the sidebar 2021-05-31 15:20:45 +02:00
Guillaume Gomez
dab01a05fb * Put crates list at all levels
* Fix bug in module sidebar: the list of items was from the parent module
2021-05-31 10:30:16 +02:00
Jacob Hoffman-Andrews
10bafe1975 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.
2021-05-30 21:15:22 -07:00
Boris-Chengbiao Zhou
8b6dad2a12 Remove --print unversioned-files from rustdoc
This flag isn't needed anymore. See #83784.
2021-05-28 21:23:53 +02:00
Guillaume Gomez
d7579b9134 Don't hide inherent implementations by default 2021-05-23 14:37:41 +02:00
Jacob Hoffman-Andrews
5ebbed6cb0 Fix auto-hide for implementations and implementors.
This sets their toggles to be closed in the HTML (matching the default
setting), and opens them if the setting indicates to do so.

This distinguishes between implementations and implementors based on
being descendants of certain named elements.
2021-05-22 09:07:24 -07:00
Jacob Hoffman-Andrews
24480ded58 Add method-toggle to <details> for methods.
The makes the code for handling "auto-hide" settings more consistent.
2021-05-18 19:25:51 -07:00
Guillaume Gomez
d151ed8699
Rollup merge of #85280 - jsha:move-trait-toggles, r=GuillaumeGomez
Toggle-wrap items differently than top-doc.

This makes sure things like trait methods get wrapped at the
`<h3><code>` level rather than at the `.docblock` level. Also it ensures
that only the actual top documentation gets the `.top-doc` class.

Fixes #85167

Before:

![image](https://user-images.githubusercontent.com/220205/117743384-98790200-b1bb-11eb-8804-588530842514.png)

https://doc.rust-lang.org/nightly/std/io/trait.Read.html#tymethod.read

After:

![image](https://user-images.githubusercontent.com/220205/118410882-98a75080-b646-11eb-949d-ca688bab6923.png)
2021-05-18 14:08:42 +02:00
bors
94ecdfd115 Auto merge of #85304 - Stupremee:crates-in-sidebar-in-root, r=Nemo157
rustdoc: Call `initSidebarItems` in root module of crate

r? `@jsha`

Resolves #85301
2021-05-16 07:32:57 +00:00
Justus K
aaf0ff83fb
Call initSidebarItems in root module of crate 2021-05-15 19:26:36 +02:00
Justus K
67d8d18b23
Minimize amount of fake DefIds used in rustdoc 2021-05-15 13:21:35 +02:00
Jacob Hoffman-Andrews
73a5c1f944 Toggle-wrap items differently than top-doc.
This makes sure things like trait methods get wrapped at the
`<h3><code>` level rather than at the `.docblock` level. Also it ensures
that only the actual top documentation gets the `.top-doc` class.
2021-05-13 23:09:24 -07:00
Guillaume Gomez
4edcf61479 End toggle migration 2021-05-10 00:09:57 +02:00
Justus K
b6120bfb35
Add type to differentiate between fake and real DefId's 2021-05-04 19:34:12 +02:00
mautamu
8db7973f19
Change librustdoc write(.. \n) to writeln(..); fix comment in grammar
More grammar
2021-05-03 02:19:57 -05:00