about summary refs log tree commit diff
path: root/src/librustdoc/json/conversions.rs
AgeCommit message (Collapse)AuthorLines
2022-07-02rustdoc-json-types: Clean up derives.Nixon Enraght-Moony-1/+1
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-06-29rustdoc-json: Make default value of blanket impl assoc types workMartin Nordholts-1/+1
2022-06-28Auto merge of #98475 - notriddle:notriddle/index-fn-signatures, r=GuillaumeGomezbors-1/+0
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-28Rollup merge of #98611 - GuillaumeGomez:rustdoc-json-glob-ice, r=notriddleMatthias Krüger-1/+6
Fix glob import ICE in rustdoc JSON format Fixes #98003. r? `@notriddle`
2022-06-28Fix glob import ICE in rustdoc JSON formatGuillaume Gomez-1/+6
2022-06-27Fix kind for associated types in rustdoc JSON output for trait implementationsGuillaume Gomez-2/+5
2022-06-24rustdoc: reference function signature types from the `p` arrayMichael Howell-1/+0
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-22Filter out keyword items in rustdoc JSON outputGuillaume Gomez-7/+4
2022-06-08rustdoc: show tuple impls as `impl Trait for (T, ...)`Michael Howell-1/+1
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-02Add Symbol into rustdoc JSON ID to prevent conflicts between reexportsGuillaume Gomez-27/+50
2022-05-23Auto merge of #94053 - GuillaumeGomez:fields-stripped, r=notriddlebors-5/+9
rustdoc: Remove fields_stripped fields (and equivalents) Fixes #90588. r? `@camelid`
2022-05-21Shrink GenericArgs/PathSegment with boxed slicesMichael Howell-2/+2
2022-05-21Remove fields_stripped fields (and equivalents)Guillaume Gomez-5/+9
2022-05-21Remove `crate` visibility modifier in libs, testsJacob Pratt-10/+12
2022-05-04rustdoc-json: Fix HRTBs for WherePredicate::BoundPredicateMartin Nordholts-2/+8
2022-04-17Stop using CRATE_DEF_INDEX.Camille GILLOT-2/+1
`CRATE_DEF_ID` and `CrateNum::as_def_id` are almost always what we want.
2022-04-16Rename `def_id` into `item_id` when the type is `ItemId` for readabilityGuillaume Gomez-7/+7
2022-04-12rustdoc: discr. required+provided assoc consts+tysLeón Orell Valerian Liehr-4/+7
2022-03-29Remove header field from clean::FunctionGuillaume Gomez-16/+21
2022-03-14rustdoc-json-types: implementors -> implementationsNixon Enraght-Moony-1/+1
Closes #94198
2022-03-13rustdoc-json-types: ty -> type_Nixon Enraght-Moony-4/+5
Fixes #94889
2022-03-04rustdoc-json: Include GenericParamDefKind::Type::synthetic in JSONMartin Nordholts-1/+2
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-03make generic projection types print correctlyMichael Goulet-3/+8
2022-02-27make GATs print properly in traitsMichael Goulet-2/+3
2022-02-18rustdoc-json: Better Header TypeNixon Enraght-Moony-23/+25
- 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-01-17Update term for use in more placeskadmin-1/+10
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.
2021-12-19Auto merge of #91957 - nnethercote:rm-SymbolStr, r=oli-obkbors-1/+1
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-15Remove `SymbolStr`.Nicholas Nethercote-1/+1
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-11rustdoc: Pretty-print assoc const defaults on-demandNoah Lev-1/+3
This should improve performance, clean up the code, and help pave the way for #83035.
2021-11-26Rename `Type::ResolvedPath` to `Type::Path`Noah Lev-4/+4
At last! The new name is shorter, simpler, and consistent with `hir::Ty`.
2021-11-25Stop re-exporting `Type::ResolvedPath`Noah Lev-5/+9
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-24Remove `ResolvedPath.did`Noah Lev-9/+5
2021-11-07rustdoc: Use `ty::ImplPolarity` instead of custom enumNoah Lev-3/+3
2021-11-07Use an enum to record polarity in `clean::Impl`Noah Lev-2/+5
2021-11-07rustdoc: Refactor `Impl.{synthetic,blanket_impl}` into enumNoah Lev-11/+9
This change has two advantages: 1. It makes the possible states clearer, and it makes it impossible to construct invalid states, such as a blanket impl that is also an auto trait impl. 2. It shrinks the size of `Impl` a bit, since now there is only one field, rather than two.
2021-11-06rustdoc: Remove redundant `Impl.span` fieldNoah Lev-1/+0
It can be computed on-demand in `Item::span()`.
2021-10-29Fix invalid handling of genericsGuillaume Gomez-0/+1
2021-10-26Remove unneeded into_iterGuillaume Gomez-1/+1
2021-10-25Fix clippy lints in librustdocGuillaume Gomez-1/+1
2021-10-18rustdoc: Box `ty` field of `GenericParamDefKind::Const`Noah Lev-1/+1
This cuts the size of `GenericParamDef` in half, from 104 bytes to 56 bytes. I think the extra indirection should be worth the size savings.
2021-10-18rustdoc: Box `default` fields of `GenericParamDefKind`Noah Lev-2/+2
This reduces the size of `GenericParamDef` a bit, but some of the size savings are hidden because of the `ty` field of the `Const` variant. I will box that in the next commit.
2021-10-09Auto merge of #88379 - camelid:cleanup-clean, r=jyn514bors-14/+23
rustdoc: Cleanup various `clean` types Cleanup various `clean` types.
2021-10-08Remove special-casing of never primitive in rustdoc-json-typesLoïc BRANSTETT-1/+0
2021-10-04Rollup merge of #88234 - hkmatsumoto:rustdoc-impls-for-primitive, r=jyn514Manish Goregaokar-1/+2
rustdoc-json: Don't ignore impls for primitive types Fix the issue discussed at [Zulip](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/.E2.9C.94.20Json.20output.20lacks.20some.20item.20which.20are.20supposed.20to.20be.20there) r? ``@jyn514``
2021-10-02Replace all uses of `path.res.def_id()` with `path.def_id()`Noah Lev-4/+4
2021-09-30Remove unnecessary `Box` in `Type::QPath`Noah Lev-1/+1
2021-09-30Use `Path` instead of `Type` in `PolyTrait`Noah Lev-14/+18
The change to `impl Clean<Path> for hir::TraitRef<'_>` was necessary to fix a test failure for `src/test/rustdoc/trait-alias-mention.rs`. Here's why: The old code path was through `impl Clean<Type> for hir::TraitRef<'_>`, which called `resolve_type`, which in turn called `register_res`. Now, because `PolyTrait` uses a `Path` instead of a `Type`, the impl of `Clean<Path>` was being run, which did not call `register_res`, causing the trait alias to not be recorded in the `external_paths` cache.
2021-09-30Make `Impl.trait_` a `Path`, not a `Type`Noah Lev-1/+6
It should only ever be a `ResolvedPath`, so this (a) enforces that, and (b) reduces the size of `Impl`. I had to update a test because the order of the rendered auto trait impl bounds changed. I think the order changed because rustdoc sorts auto trait bounds using their `Debug` output.
2021-09-29Remove Never variant from clean::Type enumGuillaume Gomez-1/+1
2021-09-29Don't ignore impls for primitive typesHirochika Matsumoto-1/+2