about summary refs log tree commit diff
path: root/src/librustdoc/json
AgeCommit message (Collapse)AuthorLines
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
2021-02-05Rollup merge of #81500 - CraftSpider:union-kind, r=jyn514Mara Bos-5/+4
Remove struct_type from union output Also bumps the format number and adds a test Rationale: It's illegal to have unions of the form `union Union(i32, f32);`, or `union Union;`. The struct_type field was recently removed from the rustdoc Union AST, at which time this field was changed to always just read "union". It makes sense to completely remove it, as it provides no information.
2021-01-28Remove struct_type from union output and bump formatRune Tynan-5/+4
2021-01-28Fix has_body for trait methodsRune Tynan-11/+9
2021-01-27Update crate name and add READMERune Tynan-2/+2
2021-01-27Simplify conversionRune Tynan-8/+1
2021-01-27Allow rustc::default_hash_types in the offending statementRune Tynan-0/+3
2021-01-27Split JSON into separately versioned crateRune Tynan-546/+54
2021-01-27More cleanupGuillaume Gomez-6/+3
2021-01-27Update to new rustdoc APIsGuillaume Gomez-1/+1
2021-01-27Remove CACHE_KEY globalGuillaume Gomez-40/+40
2021-01-23Rollup merge of #81275 - jyn514:time-render, r=wesleywiserJonas Schievink-0/+4
Fix <unknown> queries and add more timing info to render_html Closes https://github.com/rust-lang/rust/issues/81251. ## Fix `<unknown>` queries This happened because `alloc_query_strings` was never called. ## Add more timing info to render_html This still has some issues I'm not sure how to work out: - `create_renderer` and `renderer_after_krate` aren't shown by default. I want something like `verbose_generic_activity_with_arg`, but it doesn't exist. I'm also not sure how to show activities that aren't on by default - I tried `-Z self-profile -Z self-profile-args=all`, but it didn't show up. r? `@wesleywiser`
2021-01-23Add more timing info to render_htmlJoshua Nelson-0/+4
- Show `create_renderer` and `renderer_after_crate` by default - Don't rewrite `extra_verbose_generic_activity`
2021-01-22Rollup merge of #81227 - CraftSpider:struct-type-clean, r=jyn514Mara Bos-9/+9
Remove doctree::StructType Also removes it from the Union type, as unions can only ever be 'Plain'. Adds a new StructType to JSON, 'union', as the easiest way to encode the type of a union there. This leaves only one item in doctree, `Module`. r? `@jyn514`
2021-01-22Rollup merge of #81225 - CraftSpider:json-opt-docs, r=jyn514Mara Bos-4/+5
Make 'docs' nullable in rustdoc-json output Matches the backing better, and makes it so there's a difference between 'empty docs' and 'no docs'.
2021-01-21Fix rustc::internal lints on rustdocJoshua Nelson-3/+3