about summary refs log tree commit diff
path: root/src/librustdoc/json
AgeCommit message (Collapse)AuthorLines
2022-02-23Rollup merge of #94137 - aDotInTheVoid:abi-enum, r=CraftSpiderMatthias Krüger-23/+25
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 r? ``@CraftSpider`` ``@rustbot`` modify labels: +A-rustdoc-json +T-rustdoc
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-02-13rustdoc-json: buffer outputNixon Enraght-Moony-3/+6
2022-01-21Remove FIXME and fix inconsistency of local blanket impls by using HIR for themRune Tynan-14/+1
2022-01-20Rollup merge of #93099 - tomkris:rustdoc-fix, r=jshaMatthias Krüger-4/+8
rustdoc: auto create output directory when "--output-format json" This PR allows rustdoc to automatically create output directory in case it does not exist (when run with `--output-format json`). This fixes rustdoc crash: ```` $ rustdoc --output-format json -Z unstable-options src/main.rs error: couldn't generate documentation: No such file or directory (os error 2) | = note: failed to create or modify "doc/main.json" error: aborting due to previous error ```` With this fix behavior of `rustdoc --output-format json` becomes consistent with `rustdoc --output-format html` (which already auto-creates output directory if it's missing)
2022-01-20Rollup merge of #92860 - CraftSpider:rustdoc-json-impl-ice, r=jshaMatthias Krüger-1/+14
Fix errors on blanket impls by ignoring the children of generated impls Related to #83718 We can safely skip the children, as they don't contain any new info, and may be subtly different for reasons hard to track down, in ways that are consistently worse than the actual generic impl.
2022-01-19rustdoc: auto create output directory when "--output-format json"Artem Kryvokrysenko-4/+8
This PR allows rustdoc to automatically create output directory in case it does not exist (when run with `--output-format json`). This fixes rustdoc crash: ```` $ rustdoc --output-format json -Z unstable-options src/main.rs error: couldn't generate documentation: No such file or directory (os error 2) | = note: failed to create or modify "doc/main.json" error: aborting due to previous error ```` With this fix behavior of `rustdoc --output-format json` becomes consistent with `rustdoc --output-format html` (which already auto-creates output directory if it's missing)
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.
2022-01-14rustdoc: avoid many `Symbol` to `String` conversions.Nicholas Nethercote-2/+2
Particularly when constructing file paths and fully qualified paths. This avoids a lot of allocations, speeding things up on almost all examples.
2022-01-13Move FIXME to if statementRune Tynan-4/+4
2022-01-13Update comment to make it a FIXMERune Tynan-2/+4
2022-01-13inline ItemId method, clarify comments a bitRune Tynan-3/+10
2022-01-13Fix errors on blanket impls by ignoring the children of their generated ↵Rune Tynan-1/+5
implementations
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