summary refs log tree commit diff
path: root/src/librustdoc/json
AgeCommit message (Collapse)AuthorLines
2021-12-30Auto merge of #92377 - compiler-errors:rustdoc-lifetimes, r=camelid,jyn514bors-1/+1
remove in_band_lifetimes from librustdoc r? `@camelid` closes #92368
2021-12-28remove in_band_lifetimes from librustdocMichael Goulet-1/+1
2021-12-27Move `ExternalLocation` to `clean::types`Noah Lev-2/+1
It was previously defined in `render::search_index` but wasn't used at all there. `clean::types` seems like a better fit since that's where `ExternalCrate` is defined.
2021-12-27Rename `rustdoc::html::render::cache` to `search_index`Noah Lev-1/+1
The old name wasn't very clear, while the new one makes it clear that this is the code responsible for creating the search index.
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-15Moved format-version constant to rustdoc-json-typesYuval Dolev-1/+1
2021-10-09Auto merge of #88379 - camelid:cleanup-clean, r=jyn514bors-14/+23
rustdoc: Cleanup various `clean` types Cleanup various `clean` types.
2021-10-08Rollup merge of #89669 - Urgau:json-remove-type-never, r=GuillaumeGomezGuillaume Gomez-2/+1
Remove special-casing of never primitive in rustdoc-json-types Fixes https://github.com/rust-lang/rust/issues/89349 r? `@GuillaumeGomez`
2021-10-08clippy::complexity fixesMatthias Krüger-1/+1
2021-10-08Remove special-casing of never primitive in rustdoc-json-typesLoïc BRANSTETT-2/+1
2021-10-04Rollup merge of #88234 - hkmatsumoto:rustdoc-impls-for-primitive, r=jyn514Manish Goregaokar-3/+23
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-29Rollup merge of #89297 - GuillaumeGomez:remove-never-from-type-enum, r=camelidEric Huss-1/+1
Remove Never variant from clean::Type enum Fixes #89287. r? ``@camelid``
2021-09-29Remove Never variant from clean::Type enumGuillaume Gomez-1/+1
2021-09-29Don't ignore impls for primitive typesHirochika Matsumoto-3/+23
2021-09-26Fix populate of union.implsLoïc BRANSTETT-0/+2
2021-09-12Remove `Type::ResolvedPath.is_generic`Noah Lev-1/+1
It can be computed on-demand.
2021-09-12Fix broken handling of primitive itemsJoshua Nelson-3/+1
- Fix broken handling of primitive associated items - Remove fragment hack Fixes 83083 - more logging - Update CrateNum hacks The CrateNum has no relation to where in the dependency tree the crate is, only when it's loaded. Explicitly special-case core instead of assuming it will be the first DefId. - Update and add tests - Cache calculation of primitive locations This could possibly be avoided by passing a Cache into collect_intra_doc_links; but that's a much larger change, and doesn't seem valuable other than for this.
2021-09-05Auto merge of #88604 - camelid:rustdoc-lifetime-bounds, r=GuillaumeGomezbors-2/+4
rustdoc: Clean up handling of lifetime bounds Previously, rustdoc recorded lifetime bounds by rendering them into the name of the lifetime parameter. Now, it leaves the name as the actual name and instead records lifetime bounds in an `outlives` list, similar to how type parameter bounds are recorded. Also, higher-ranked lifetimes cannot currently have bounds, so I simplified the code to reflect that. r? `@GuillaumeGomez`
2021-09-03rustdoc: Box `GenericArg::Const` to reduce enum sizeNoah Lev-1/+1
2021-09-02rustdoc: Clean up handling of lifetime boundsNoah Lev-2/+4
Previously, rustdoc recorded lifetime bounds by rendering them into the name of the lifetime parameter. Now, it leaves the name as the actual name and instead records lifetime bounds in an `outlives` list, similar to how type parameter bounds are recorded.
2021-09-02Auto merge of #88522 - camelid:box-paren-output, r=jyn514bors-1/+1
rustdoc: Box `GenericArgs::Parenthesized.output` Split out from #88379. This reduces the size of `GenericArgs` from 104 bytes to 56 bytes, essentially reducing it by half. `GenericArgs` is one of the fields of `PathSegment`, so this should reduce the amount of memory allocated for `PathSegment`s in the cases where the generics are not for a `Fn`, `FnMut`, or `FnOnce` trait. r? `@jyn514`
2021-08-31Box `GenericArgs::Parenthesized.output`Noah Lev-1/+1
This reduces the size of `GenericArgs` from 104 bytes to 56 bytes, essentially reducing it by half. `GenericArgs` is one of the fields of `PathSegment`, so this should reduce the amount of memory allocated for `PathSegment`s in the cases where the generics are not for a `Fn`, `FnMut`, or `FnOnce` trait. I also added `static_assert_size!`s to `GenericArgs` and `PathSegment` to ensure they don't increase in size unexpectedly.
2021-08-29Use the correct type for Enum variant tuplesGuillaume Gomez-1/+12
2021-07-25Add generic arg inferkadmin-0/+1
2021-07-05rustdoc: Use `impl_id` and `for_` DefId's for Blanket item idJustus K-2/+2
2021-07-05rustdoc: Add `PrimitiveType` to `ItemId::Primitive`Justus K-1/+1
2021-07-05rustdoc: Convert new ItemId's to real Json IdsJustus K-3/+18
2021-07-05Revert "rustdoc: Store DefId's in ItemId on heap for decreasing Item's size"Justus K-18/+17
This reverts commit 41a345d4c46dad1a98c9993bc78513415994e8ba.
2021-07-05rustdoc: Store DefId's in ItemId on heap for decreasing Item's sizeJustus K-17/+18
2021-07-05rustdoc: Rename `expect_real` to `expect_def_id`, remove `Item::is_fake`Justus K-3/+3
2021-07-05rustdoc: Replace `FakeDefId` with new `ItemId` typeJustus K-21/+19
2021-06-19rustdoc: Introduce new `DynTrait` type for better representation of trait ↵Justus K-4/+25
objects