1
Fork 0
Commit graph

159 commits

Author SHA1 Message Date
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
Michael Howell
238bcc940f rustdoc: box ItemKind::Trait
This reduces the memory consumption of ItemKind.
2022-08-16 13:09:37 -07: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
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
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
Michael Howell
6950f144cf rustdoc: show tuple impls as impl Trait for (T, ...)
This commit adds a new unstable attribute, `#[doc(tuple_varadic)]`, that
shows a 1-tuple as `(T, ...)` instead of just `(T,)`, and links to a section
in the tuple primitive docs that talks about these.
2022-06-08 19:26:51 -07:00
Guillaume Gomez
77e729ea92 Add Symbol into rustdoc JSON ID to prevent conflicts between reexports 2022-06-02 11:14:32 +02:00
bors
222c5724ec Auto merge of #94053 - GuillaumeGomez:fields-stripped, r=notriddle
rustdoc: Remove fields_stripped fields (and equivalents)

Fixes #90588.

r? `@camelid`
2022-05-23 18:26:42 +00:00
Michael Howell
08237d8a6d Shrink GenericArgs/PathSegment with boxed slices 2022-05-21 07:55:13 -07:00
Guillaume Gomez
6092cbb17c Remove fields_stripped fields (and equivalents) 2022-05-21 13:21:12 +02:00
Jacob Pratt
6970246886
Remove crate visibility modifier in libs, tests 2022-05-21 00:32:47 -04:00
Martin Nordholts
1f15ce5f97 rustdoc-json: Fix HRTBs for WherePredicate::BoundPredicate 2022-05-04 21:03:01 +02:00
Camille GILLOT
07ee031763 Stop using CRATE_DEF_INDEX.
`CRATE_DEF_ID` and `CrateNum::as_def_id` are almost always what we want.
2022-04-17 12:14:42 +02:00
Guillaume Gomez
b1e6211c5c Rename def_id into item_id when the type is ItemId for readability 2022-04-16 14:28:09 +02:00
León Orell Valerian Liehr
8de453a8c6 rustdoc: discr. required+provided assoc consts+tys 2022-04-12 15:38:39 +02:00
Guillaume Gomez
2c4ce9d2dc Remove header field from clean::Function 2022-03-29 11:46:57 +02:00
Nixon Enraght-Moony
a5c0b1470c rustdoc-json-types: implementors -> implementations
Closes #94198
2022-03-14 00:05:11 +00:00
Nixon Enraght-Moony
b526d8f27c rustdoc-json-types: ty -> type_
Fixes #94889
2022-03-13 23:13:57 +00:00
Martin Nordholts
aa763fcf42 rustdoc-json: Include GenericParamDefKind::Type::synthetic in JSON
The rustdoc JSON for

```
pub fn f(_: impl Clone) {}
```

will effectively be

```
pub fn f<impl Clone: Clone>(_: impl Clone)
```

where a synthetic generic parameter called `impl Clone` with generic
trait bound `Clone` is added to the function declaration.

The generated HTML filters out these generic parameters by doing
`self.params.iter().filter(|p| !p.is_synthetic_type_param())`, because
the synthetic generic parameter is not of interest to regular users.

For the same reason, we should expose whether or not a generic parameter
is synthetic or not also in the rustdoc JSON, so that rustdoc JSON
clients can also have the option to hide synthetic generic parameters.
2022-03-04 05:54:12 +01:00
Michael Goulet
aefc0a223a make generic projection types print correctly 2022-03-03 13:01:35 -08:00
Michael Goulet
ca6e06efba make GATs print properly in traits 2022-02-27 21:36:29 -08:00
Nixon Enraght-Moony
aa601574a5 rustdoc-json: Better Header Type
- Make ABI an enum, instead of being stringly typed
- Replace Qualifier HashSet with 3 bools
- Merge ABI field into header, as they always occor together
2022-02-18 23:31:33 +00:00
kadmin
e7529d6a38 Update term for use in more places
Replace use of `ty()` on term and use it in more places. This will allow more flexibility in the
future, but slightly worried it allows items which are consts which only accept types.
2022-01-17 19:59:40 +00:00
bors
a41a6925ba Auto merge of #91957 - nnethercote:rm-SymbolStr, r=oli-obk
Remove `SymbolStr`

This was originally proposed in https://github.com/rust-lang/rust/pull/74554#discussion_r466203544. As well as removing the icky `SymbolStr` type, it allows the removal of a lot of `&` and `*` occurrences.

Best reviewed one commit at a time.

r? `@oli-obk`
2021-12-19 09:31:37 +00:00
Nicholas Nethercote
8cddcd39ba Remove SymbolStr.
By changing `as_str()` to take `&self` instead of `self`, we can just
return `&str`. We're still lying about lifetimes, but it's a smaller lie
than before, where `SymbolStr` contained a (fake) `&'static str`!
2021-12-15 13:30:26 +11:00
Noah Lev
d38ae767f8 rustdoc: Pretty-print assoc const defaults on-demand
This should improve performance, clean up the code, and help pave the
way for #83035.
2021-12-11 14:22:34 -08:00
Noah Lev
79c718f1d5 Rename Type::ResolvedPath to Type::Path
At last! The new name is shorter, simpler, and consistent with
`hir::Ty`.
2021-11-26 12:40:27 -08:00
Noah Lev
d81deb33fa Stop re-exporting Type::ResolvedPath
I would like to rename it to `Type::Path`, but then it can't be
re-exported since the name would conflict with the `Path` struct.
Usually enum variants are referred to using their qualified names in
Rust (and parts of rustdoc already do that with `clean::Type`), so this
is also more consistent with the language.
2021-11-25 12:08:05 -08:00