about summary refs log tree commit diff
path: root/src/librustdoc/json
AgeCommit message (Collapse)AuthorLines
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
2021-03-06Add roundtrip testing and bump format versionRune Tynan-1/+1
2021-03-06Remove Item::kind, use tagged enum. Rename variants to matchRune Tynan-32/+29
2021-03-05Don't unnecessarily clone some fields in `Context`Camelid-0/+4
There was no need to clone `id_map` because it was reset before each item was rendered. `deref_id_map` was not reset, but it was keyed by `DefId` and thus was unlikely to have collisions (at least for now). Now we just clone the fields that need to be cloned, and instead create fresh versions of the others.
2021-03-05Refactor from_clean_item_kind to improve ExternCrateItem handlingGuillaume Gomez-8/+7
2021-03-05Make ItemKind::ExternCrate looks like hir::ItemKind::ExternCrate to make ↵Guillaume Gomez-30/+34
transition over hir::ItemKind simpler
2021-03-01Remove `krate.version`; fix `crate_version` in JSONJoshua Nelson-2/+2
Previously, `JsonRenderer::after_krate` called `krate.version.clone()`. The problem was it did that after the version was already moved into the cache, so it would always be None. The fix was to get the version from the cache instead.
2021-03-01Remove the dummy cache in `DocContext`Joshua Nelson-2/+1
The same information is available everywhere; the only reason the dummy cache was needed is because it waas previously stored in three different places. This consolidates the info a bit so the cache in `DocContext` is used throughout. As a bonus, it means `renderinfo` is used much much less. - Return a `Cache` from `run_global_ctxt`, not `RenderInfo` - Remove the unused `render_info` from `run_renderer` - Remove RefCell around `inlined` - Add intra-doc links
2021-02-23Put clean::Trait extra information into a new struct to make it more coherentGuillaume Gomez-1/+2
2021-02-23Remove is_spotlight field from `Trait`Guillaume Gomez-2/+2
2021-02-19Auto merge of #82020 - jyn514:mut-passes, r=camelid,GuillaumeGomezbors-2/+2
Make `Clean` take &mut DocContext - Take `FnMut` in `rustc_trait_selection::find_auto_trait_generics` - Take `&mut DocContext` in most of `clean` - Collect the iterator in auto_trait_impls instead of iterating lazily; the lifetimes were really bad. This combined with https://github.com/rust-lang/rust/pull/82018 should hopefully help with https://github.com/rust-lang/rust/pull/82014 by allowing `cx.cache.exported_traits` to be modified in `register_res`. Previously it had to use interior mutability, which required either adding a RefCell to `cache.exported_traits` on *top* of the existing `RefCell<Cache>` or mixing reads and writes between `cx.exported_traits` and `cx.cache.exported_traits`. I don't currently have that working but I expect it to be reasonably easy to add after this.
2021-02-17avoid converting types into themselves (clippy::useless_conversion)Matthias Krüger-1/+1
2021-02-16Make `Clean` take &mut DocContextJoshua Nelson-2/+2
- Take `FnMut` in `rustc_trait_selection::find_auto_trait_generics` - Take `&mut DocContext` in most of `clean` - Collect the iterator in auto_trait_impls instead of iterating lazily; the lifetimes were really bad. - Changes `fn sess` to properly return a borrow with the lifetime of `'tcx`, not the mutable borrow.
2021-02-14Rollup merge of #81891 - CraftSpider:fn-header, r=jyn514Dylan DPC-11/+27
[rustdoc-json] Make `header` a vec of modifiers, and FunctionPointer consistent Bumps version number and adds tests, this is a breaking change. I can split this into two (`is_unsafe` -> `header` and `header: Vec<Modifiers>`) if desired. Rationale: Modifiers are individual notes on a function, it makes more sense for them to be a list of an independent enum over a String which is inconsistently exposing the HIR representation (prefix_str vs custom literals). Function pointers currently only support `unsafe`, but there has been talk on and off about allowing them to also support `const`, and this makes handling their modifiers consistent with handling those of a function, allowing better shared code. `@rustbot` modify labels: +A-rustdoc-json +T-rustdoc CC: `@HeroicKatora` r? `@jyn514`
2021-02-12Modifiers -> QualifiersRune Tynan-5/+5
2021-02-12Rollup merge of #82004 - GuillaumeGomez:clean-static-struct, r=jyn514Yuki Okushi-46/+44
clean up clean::Static struct Having a `String` for the expression didn't make much sense, and even less when it's actually not used (except in json so I kept it). r? ``@jyn514``
2021-02-11clean up clean::Static structGuillaume Gomez-46/+44
2021-02-08Allow default hash types in conversionRune Tynan-0/+2
2021-02-08Vec -> HashSetRune Tynan-7/+10
2021-02-08Make `header` a vec of modifiers, make FunctionPointer consistent with ↵Rune Tynan-11/+22
Function and Method.
2021-02-07Auto merge of #81502 - CraftSpider:method-abi, r=jyn514bors-0/+1
Add abi field to `Method` Also bumps version and adds a test (Will conflict with #81500, whichever is merged first) Rationale: It's possible for methods to have an ABI. This should be exposed in the JSON.
2021-02-06Remove accidentally left-behind git markRune Tynan-1/+0
2021-02-05Add abi field to `Method`Rune Tynan-0/+2
2021-02-05Remove Function all_types and ret_types fieldsGuillaume Gomez-2/+2