Commit Graph

295 Commits

Author SHA1 Message Date
Michael Howell
24714b84ea rustdoc: remove unneeded Box from ItemKind 2022-11-02 16:17:24 -07:00
Guillaume Gomez
5515e2c2a1 Make rustdoc Item::visibility computed on-demand 2022-10-30 16:50:53 +01:00
León Orell Valerian Liehr
73c239e5eb rustdoc: render more cross-crate hrtbs properly 2022-10-05 23:14:15 +02:00
Michael Howell
a63a03dc54 rustdoc: remove clean::TraitWithExtraInfo
Instead, it gathers the extra info later, when it's actually requested.
2022-09-27 12:27:04 -07:00
Nixon Enraght-Moony
aac7429c17 Rustdoc-Json: List impls for primitives
Closes #101695
2022-09-26 18:06:48 +01:00
Nixon Enraght-Moony
e80ccd3d3a Rustdoc-Json: Don't loose subitems of foreign traits. 2022-09-13 18:34:15 +01:00
Nixon Enraght-Moony
2c17099671 Rustdoc-Json: Correcty handle intra-doc-links to items without HTML page
Closes #101531
2022-09-10 00:40:30 +01:00
Nixon Enraght-Moony
1c8de17323 Rustdoc-Json: More accurate struct type.
Closes #101489
2022-09-07 09:42:23 +01:00
Nixon Enraght-Moony
065e0b9c9c Rustdoc-Json: Store Variant Fields as their own item.
Closes #100587
Closes #92945
2022-09-05 23:59:33 +01:00
bors
406e03fd02 Auto merge of #101386 - aDotInTheVoid:rdj-discriminant, r=GuillaumeGomez
Rustdoc-Json: Add enum discriminant

Does the first part of #101337, by adding it to `clean`, but doesn't change HTML output, as

1. [No Consensus has appeared on the UI for this](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/Enum.20discriminant.20values.20in.20HTML.20output)
2. [When inlining across crates, information is lost](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/.60clean_variant_def.20.60vs.20.60clean_variant_data.60)

JSON doesn't have either of these limitations.

r? `@GuillaumeGomez`
2022-09-05 04:16:08 +00:00
Nixon Enraght-Moony
efbd8f62ed rustdoc: Compute enum discriminant on demand 2022-09-04 12:53:25 +01:00
Nixon Enraght-Moony
b76a012be1 Rustdoc-Json: Add enum discriminant 2022-09-03 22:15:26 +01:00
Matthias Krüger
57198b549f remove redundant clones 2022-09-03 07:58:41 +02:00
Matthias Krüger
ecd908ac5e Rollup merge of #101106 - aDotInTheVoid:rdj-stripped-mod, r=GuillaumeGomez
Rustdoc-Json: Retain Stripped Modules when they are imported, not when they have items

Fixes #101103
Fixes #100973

r? `@GuillaumeGomez`
2022-08-29 21:12:56 +02:00
Nixon Enraght-Moony
8050c1993b Rustdoc-Json: Retain Stripped Modules when they are imported, not when they have items.
Fixes #101103
Fixes #100973
2022-08-29 00:15:10 +01:00
bors
ce36e88256 Auto merge of #100497 - kadiwa4:remove_clone_into_iter, r=cjgillot
Avoid cloning a collection only to iterate over it

`@rustbot` label: +C-cleanup
2022-08-28 18:31:08 +00:00
bors
650bff80a6 Auto merge of #100645 - notriddle:notriddle/rustdoc-diet-plan, r=GuillaumeGomez
rustdoc: strategic boxing to reduce the size of ItemKind and Type

The `Type` change redesigns `QPath` to box the entire data structure instead of boxing `self_type` and the `trait_`.

This reduces the size of several `ItemKind` variants, leaving `Impl` as the biggest variant. The `ItemKind` change boxes that variant's payload.
2022-08-21 16:40:26 +00:00
Michael Howell
238bcc940f rustdoc: box ItemKind::Trait
This reduces the memory consumption of ItemKind.
2022-08-16 13:09:37 -07:00
Takayuki Maeda
af74e7232f Rollup merge of #100630 - Enselic:export_extern_crate_as_self, r=GuillaumeGomez
rustdoc JSON: Fix ICE with `pub extern crate self as <self_crate_name>`

Closes #100531

r? `@GuillaumeGomez`

`@rustbot` labels +A-rustdoc-json +T-rustdoc
2022-08-17 05:08:05 +09:00
Michael Howell
2aa4aa70dd rustdoc: factor Type::QPath out into its own box
This reduces the size of Type.
2022-08-16 12:48:04 -07:00
Martin Nordholts
dbeb506eae rustdoc JSON: Fix ICE with pub extern crate self as <self_crate_name> 2022-08-16 15:54:50 +02:00
Guillaume Gomez
c4a5ac2a77 Handle correctly stripped enum variant fields 2022-08-15 16:36:07 +02:00
Michael Goulet
4989f6a724 Rollup merge of #100335 - aDotInTheVoid:rdj-resolved-path, r=GuillaumeGomez
Rustdoc-Json: Add `Path` type for traits.

Avoids using `Type` for trait fields, as a trait must always be a path, and not any other kind of type.

``@rustbot`` modify labels: +A-rustdoc-json +T-rustdoc

Closes #100106
2022-08-13 21:06:48 -07:00
Michael Goulet
752b0e0672 make clean::Item::span return option instead of dummy span 2022-08-13 22:03:47 +00:00
KaDiWa
4eebcb9910 avoid cloning and then iterating 2022-08-13 16:16:52 +02:00
Nixon Enraght-Moony
86bdb3ed09 Rustdoc-Json: Add Path type for traits.
Closes #100106
2022-08-10 10:21:52 +01:00
Matthias Krüger
0dc39c7bd9 Rollup merge of #99479 - Enselic:import-can-be-without-id, r=camelid
rustdoc-json: Remove doc FIXME for Import::id and explain

Also add some test and refactor related code a bit.

``@rustbot`` labels +A-rustdoc-json +T-rustdoc
2022-08-10 00:00:24 +02:00
Nixon Enraght-Moony
6290f92d07 Rustdoc-Json: Add and use FromWithTcx for Vec 2022-08-03 14:17:26 +01:00
Nixon Enraght-Moony
625c4d70ff Rustdoc-Json: Extract convert_lifetime to function 2022-08-03 14:17:26 +01:00
Nixon Enraght-Moony
a856e57f6c Rustdoc-Json: Document HRTB's on DynTrait
Closes #99118
2022-08-03 14:17:26 +01:00
est31
1116fc164f Box FunctionItem, TyMethodItem, MethodItem, ForeignFunctionItem
This reduces ItemKind size from 160 bytes to 112 bytes
2022-07-29 19:30:25 +02:00
est31
96c051fd07 Box TypedefItem, ImplItem, AssocTypeItem variants of ItemKind
This reduces ItemKind size from 224 bytes to 160 bytes.
2022-07-29 19:30:25 +02:00
bors
ffa77332c6 Auto merge of #99598 - GuillaumeGomez:clean-trait-fields-on-demand, r=notriddle
Make some clean::Trait fields computation on demand

r? `@notriddle`
2022-07-22 16:52:10 +00:00
Guillaume Gomez
edb9add193 Make some clean::Trait fields computation on demand 2022-07-22 14:26:05 +02:00
Guillaume Gomez
8e150816c2 Remove unused field in ItemKind::KeywordItem 2022-07-21 16:05:17 +02:00
Martin Nordholts
4e73d90ce0 rustdoc-json: De-duplicate FromWithTcx<clean::Import> 2022-07-19 22:43:39 +02:00
Michael Howell
1169832f2f rustdoc: extend #[doc(tuple_variadic)] to fn pointers
The attribute is also renamed `fake_variadic`.
2022-07-17 16:32:06 -07:00
Guillaume Gomez
1a15c7147f Fix rustdoc JSON inline 2022-07-16 13:39:38 +02:00
Nixon Enraght-Moony
18aea4594b rustdoc-json-types: Clean up derives.
Closes #96189

Closes #96189

Everything is `Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize`
except `Crate` and `Item` which arn't `Hash`, as they have `HashMap`'s.
See linked issue for reasoning.
2022-07-02 00:11:29 +01:00
Martin Nordholts
ba87c934ea rustdoc-json: Make default value of blanket impl assoc types work 2022-06-29 21:05:51 +02:00
bors
2953edc7b7 Auto merge of #98475 - notriddle:notriddle/index-fn-signatures, r=GuillaumeGomez
rustdoc: reference function signature types from the `p` array

This reduces the size of the function signature index, because it's common to have many functions that operate on the same types.

    $ wc -c search-index-old.js search-index-new.js
    5224374 search-index-old.js
    3932314 search-index-new.js

By my math, this reduces the uncompressed size of the search index by 32%.
On compressed signatures, the wins are less drastic, a mere 8%:

    $ wc -c search-index-old.js.gz search-index-new.js.gz
    404532 search-index-old.js.gz
    371635 search-index-new.js.gz
2022-06-28 21:40:10 +00:00
Matthias Krüger
956a9f55c0 Rollup merge of #98611 - GuillaumeGomez:rustdoc-json-glob-ice, r=notriddle
Fix glob import ICE in rustdoc JSON format

Fixes #98003.

r? `@notriddle`
2022-06-28 18:34:32 +02:00
Guillaume Gomez
b7e62000dd Fix glob import ICE in rustdoc JSON format 2022-06-28 11:46:03 +02:00
Guillaume Gomez
c1c0d25939 Fix kind for associated types in rustdoc JSON output for trait implementations 2022-06-27 16:01:13 +02:00
Michael Howell
dc1fc08dc9 rustdoc: reference function signature types from the p array
This reduces the size of the function signature index, because
it's common to have many functions that operate on the same types.

    $ wc -c search-index-old.js search-index-new.js
    5224374 search-index-old.js
    3932314 search-index-new.js

By my math, this reduces the uncompressed size of the search index by 32%.
On compressed signatures, the wins are less drastic, a mere 8%:

    $ wc -c search-index-old.js.gz search-index-new.js.gz
    404532 search-index-old.js.gz
    371635 search-index-new.js.gz
2022-06-24 18:16:33 -07:00
Guillaume Gomez
8e40d93647 Filter out keyword items in rustdoc JSON output 2022-06-22 16:26:04 +02:00
Yuki Okushi
4557ff7bd7 Rollup merge of #98195 - GuillaumeGomez:rustdoc-json-primitive, r=notriddle
Fix rustdoc json primitive handling

Fixes https://github.com/rust-lang/rust/issues/98006.

cc `@matthiaskrgr`
2022-06-18 10:03:25 +09:00
Guillaume Gomez
87d90b1332 Fix rustdoc handling of primitive documentation 2022-06-17 14:41:07 +02:00
bors
6ec3993ef4 Auto merge of #97842 - notriddle:notriddle/tuple-docs, r=jsha,GuillaumeGomez
Improve the tuple and unit trait docs

* Reduce duplicate impls; show only the `(T,)` and include a sentence saying that there exists ones up to twelve of them.
* Show `Copy` and `Clone`.
* Show auto traits like `Send` and `Sync`, and blanket impls like `Any`.

Here's the new version:

* <https://notriddle.com/notriddle-rustdoc-test/std/primitive.tuple.html>
* <https://notriddle.com/notriddle-rustdoc-test/std/primitive.unit.html>
2022-06-16 11:13:30 +00:00
Guillaume Gomez
a752f82f19 Ignore impl items because they can be duplicated in case of generic impl 2022-06-13 15:29:29 +02:00