summary refs log tree commit diff
path: root/src/librustdoc/json
AgeCommit message (Collapse)AuthorLines
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
2021-06-18rustdoc: Render `for<'_>` lifetimes in trait objectsJustus K-1/+1
2021-06-18rustdoc: Render `for<'_>` lifetimes in front of where boundJustus K-1/+2
2021-06-09Rollup merge of #85957 - BoxyUwU:rustdoc-const-generic-defaults, r=oli-obkYuki Okushi-2/+4
Display defaults on const params- rustdoc previously rustdoc would render this struct declaration: `pub struct Foo<const N: usize = 10>;` as: `pub struct Foo<const N: usize>;` this PR changes it to render correctly
2021-06-07format versionEllen-1/+1
2021-06-05Rollup merge of #84466 - jyn514:prim-str, r=GuillaumeGomezYuki Okushi-1/+1
rustdoc: Remove `PrimitiveType::{to_url_str, as_str}` These can easily be rewritten in terms of `as_sym`, and this avoids bugs where the two get out of sync. I don't expect this to have a perf impact, but I'll start a perf run just in case.
2021-06-03rustdoc- Show defaults on const generics Ellen-1/+3
2021-05-20Remove `PrimitiveType::as_str`Joshua Nelson-1/+1
2021-05-19rustdoc: render `<Self as X>::Y` type casts properlyJustus K-1/+1
2021-05-15Minimize amount of fake `DefId`s used in rustdocJustus K-10/+10
2021-05-14Box `Impl.blanket_impl` to reduce sizeNoah Lev-1/+1
Blanket impls are probably not super common, and `Type` is a fairly large type, so this should reduce `Impl`'s size by a lot: `Option<Type>` is around 96 bytes, and `Option<Box<Type>>` is 8 bytes, so it's a big difference!
2021-05-12Auto merge of #83813 - cbeuw:remap-std, r=michaelwoeristerbors-12/+11
Fix `--remap-path-prefix` not correctly remapping `rust-src` component paths and unify handling of path mapping with virtualized paths This PR fixes #73167 ("Binaries end up containing path to the rust-src component despite `--remap-path-prefix`") by preventing real local filesystem paths from reaching compilation output if the path is supposed to be remapped. `RealFileName::Named` introduced in #72767 is now renamed as `LocalPath`, because this variant wraps a (most likely) valid local filesystem path. `RealFileName::Devirtualized` is renamed as `Remapped` to be used for remapped path from a real path via `--remap-path-prefix` argument, as well as real path inferred from a virtualized (during compiler bootstrapping) `/rustc/...` path. The `local_path` field is now an `Option<PathBuf>`, as it will be set to `None` before serialisation, so it never reaches any build output. Attempting to serialise a non-`None` `local_path` will cause an assertion faliure. When a path is remapped, a `RealFileName::Remapped` variant is created. The original path is preserved in `local_path` field and the remapped path is saved in `virtual_name` field. Previously, the `local_path` is directly modified which goes against its purpose of "suitable for reading from the file system on the local host". `rustc_span::SourceFile`'s fields `unmapped_path` (introduced by #44940) and `name_was_remapped` (introduced by #41508 when `--remap-path-prefix` feature originally added) are removed, as these two pieces of information can be inferred from the `name` field: if it's anything other than a `FileName::Real(_)`, or if it is a `FileName::Real(RealFileName::LocalPath(_))`, then clearly `name_was_remapped` would've been false and `unmapped_path` would've been `None`. If it is a `FileName::Real(RealFileName::Remapped{local_path, virtual_name})`, then `name_was_remapped` would've been true and `unmapped_path` would've been `Some(local_path)`. cc `@eddyb` who implemented `/rustc/...` path devirtualisation
2021-05-05Make local_path in RealFileName::Remapped Option to be removed in exported ↵Andy Wang-7/+11
metadata
2021-05-05Rename RealFileName::Named to LocalPath and Devirtualized to RemappedAndy Wang-6/+1
2021-05-04Add type to differentiate between fake and real DefId'sJustus K-15/+22
2021-05-01Rollup merge of #84601 - tdelabro:rustdoc-get-rid-of-cache-extern_locations, ↵Yuki Okushi-5/+6
r=jyn514 rustdoc: Only store locations in Cache::extern_locations and calculate the other info on-demand help #84588
2021-04-30Remove unnecessary `provided_trait_methods` field from ImplJoshua Nelson-1/+1
It can be calculated on-demand.
2021-04-29only store locations in extern_locationsTimothée Delabrouille-5/+6
2021-04-27cfg taken out of Attributes, put in ItemTimothée Delabrouille-1/+1
check item.is_fake() instead of self_id.is_some() Remove empty branching in Attributes::from_ast diverse small refacto after Josha review cfg computation moved in merge_attrs refacto use from_ast twice for coherence take cfg out of Attributes and move it to Item
2021-04-27Removed usage of Attributes in FnDecl and ExternalCrate. Relocate part of ↵Timothée Delabrouille-1/+1
the fields in Attributes, as functions in AttributesExt. refacto use from_def_id_and_attrs_and_parts instead of an old trick most of josha suggestions + check if def_id is not fake before using it in a query Removed usage of Attributes in FnDecl and ExternalCrate. Relocate part of the Attributes fields as functions in AttributesExt.
2021-04-24Get rid of `item.span`Joshua Nelson-2/+3
- Remove `span` field, adding `Item::span()` instead - Special-case `Impl` and `Module` items - Use dummy spans for primitive items
2021-04-24Do the hard part firstJoshua Nelson-1/+2
The only bit failing was the module, so change that before removing the `span` field.
2021-04-25Rollup merge of #84460 - jyn514:doctree-is-crate, r=camelidYuki Okushi-19/+17
rustdoc: Remove unnecessary `is_crate` field from doctree::Module and clean::Module It can be calculated on-demand even without a TyCtxt. This also changed `json::conversions::from_item_kind` to take a whole item, which avoids having to add more and more parameters. Helps with https://github.com/rust-lang/rust/issues/76382. r? ```@camelid```
2021-04-24rustdoc: Turn `JsonRenderer::mod_item_in` into `unreachable!()`Joshua Nelson-15/+2
The JSON renderer no longer gets called on modules.
2021-04-23rustdoc: Remove unnecessary `is_crate` field from doctree::Module and ↵Joshua Nelson-19/+17
clean::Module It can be calculated on-demand even without a TyCtxt. This also changed `from_item_kind` to take a whole item, which avoids having to add more and more parameters.
2021-04-22Remove unnecessary item_name parameter to `mod_item_in`Joshua Nelson-1/+1
2021-04-22Remove unnecessary `item_name` parameter to `mod_item_out`Joshua Nelson-4/+0
2021-04-22Remove unnecessary `edition` parameter to rendererJoshua Nelson-2/+0
2021-04-22Remove unnecessary `diag` parameter to `after_krate`Joshua Nelson-1/+1
2021-04-22Remove unnecessary `crate_name` parameter to `after_krate`Joshua Nelson-6/+2
It's always `tcx.crate_name(LOCAL_CRATE)`, it doesn't need to be passed in separately.
2021-04-06Store links in Cache instead of on items directlyJoshua Nelson-7/+11
Items are first built after rustdoc creates the TyCtxt. To allow resolving the links before the TyCtxt is built, the links can't be stored on `clean::Item` directly.
2021-03-26Rollup merge of #83055 - aDotInTheVoid:selective-strip-item-doc, r=jyn514Dylan DPC-2/+7
[rustdoc] Don't document stripped items in JSON renderer. Fixes #80664, see [my comment there](https://github.com/rust-lang/rust/issues/80664#issuecomment-797557948) for why Note that we already do something similar in `convert_item`: https://github.com/rust-lang/rust/blob/bb4cdf8ec034dca5c056ec9295f38062e5b7e871/src/librustdoc/json/conversions.rs#L28-L31 ``@rustbot`` modify labels: +T-rustdoc +A-rustdoc-json r? ``@jyn514`` cc ``@CraftSpider``
2021-03-24Split clean::Constant enum into a struct and an enumGuillaume Gomez-1/+1
2021-03-24Rework rustdoc const typeGuillaume Gomez-146/+182
2021-03-24Don't call `item` on modules for json rendererNixon Enraght-Moony-2/+7
Closes #80664
2021-03-24Rollup merge of #83415 - camelid:remove-crate-module-option, r=jyn514Dylan DPC-2/+2
Remove unnecessary `Option` wrapping around `Crate.module` I'm wondering if it was originally there so that we could `take` the module which enables `after_krate` to take an `&Crate`. However, the two impls of `after_krate` only use `Crate.name`, so we can pass just the name instead.
2021-03-23Remove unnecessary `Option` wrapping around `Crate.module`Camelid-2/+2
I'm wondering if it was originally there so that we could `take` the module which enables `after_krate` to take an `&Crate`. However, the two impls of `after_krate` only use `Crate.name`, so we can pass just the name instead.
2021-03-21Bump rustdoc-json format versionCamelid-1/+1
The rustdoc-json-types renames are breaking changes.
2021-03-21rustdoc-json: Rename `Import.span` to `Import.source`Camelid-2/+2
* It is called `source` in rustc and the rest of rustdoc * It is not a span, rather it is the source of the import
2021-03-21Rename `rustdoc_json_types::Item.source` to `span`Camelid-2/+2
2021-03-21Rename `clean::Item.source` to `span`Camelid-2/+2
Its type is called `clean::Span`, and also the name in the rest of rustdoc and rustc for this kind of field is `span`.
2021-03-09Auto merge of #82356 - camelid:render-cleanup, r=GuillaumeGomezbors-0/+4
rustdoc: Cleanup `html::render::Context` - Move most shared fields to `SharedContext` (except for `cache`, which isn't mutated anyway) - Replace a use of `Arc` with `Rc` - Make a bunch of fields private - Add static size assertion for `Context` - Don't share `id_map` and `deref_id_map`
2021-03-06Revert fmt version, add rustdoc-json-types to bootstrap testsRune Tynan-1/+1