about summary refs log tree commit diff
path: root/src/librustdoc/json/mod.rs
AgeCommit message (Collapse)AuthorLines
2025-08-23Do macro expansion at AST level rather than HIRGuillaume Gomez-9/+11
2025-07-19Fix clippy lints in librustdocGuillaume Gomez-3/+3
2025-06-21rustdoc_json: represent generic args consistently.Nicholas Nethercote-1/+1
They show up in three places: once as `Option<Box<GenericArgs>>`, once as `Box<GenericArgs>`, and once as `GenericArgs`. The first option is best. It is more compact because generic args are often missing. This commit changes the latter two to the former. Example output, before and after, for the `AssocItemConstraint` change: ``` {"name":"Offset","args":{"angle_bracketed":{"args":[],"constraints":[]}},"binding":{...}} {"name":"Offset","args":null,"binding":{...}} ``` Example output, before and after, for the `Type::QualifiedPath` change: ``` {"qualified_path":{"name":"Offset","args":{"angle_bracketed":{"args":[],"constraints":[]}}, ...}} {"qualified_path":{"name":"Offset","args":null, ...}} ``` This reduces JSON output size, but not by much (e.g. 0.5%), because `AssocItemConstraint` and `Type::QualifiedPath` are uncommon.
2025-06-21rustdoc_json: Add static asserts for the size of important types.Nicholas Nethercote-0/+30
A lot of these are large! Lots of room for improvement in the future.
2025-06-20Rollup merge of #142755 - aDotInTheVoid:rdj-shattrs, r=GuillaumeGomezTrevor Gross-4/+0
rustdoc: Remove `FormatRenderer::cache` We only called it it one place, which isn't generic and can be replaced with a field access.
2025-06-19rustdoc: Remove `FormatRenderer::cache`Alona Enraght-Moony-4/+0
We only called it it one place, which isn't generic and can be replaced with a field access.
2025-06-19move -Ctarget-feature handling into shared codeRalf Jung-3/+2
2025-06-14Auto merge of #142335 - nnethercote:rustdoc-json-allocations, r=aDotInTheVoidbors-19/+29
rustdoc_json: reduce allocations These commits reduce the number of allocations done for rustdoc_json, mostly by avoiding unnecessary clones. Best reviewed one commit at a time. r? `@aDotInTheVoid`
2025-06-11Don't clone `new_item` in `after_krate`.Nicholas Nethercote-7/+16
We can avoid it by using the `entry` API, which lets us do the `assert_eq` comparison before `new_item` is consumed.
2025-06-11Avoid more clones in rustdoc JSON output.Nicholas Nethercote-5/+5
By making `JsonRenderer::item` take `&clean::Item` instead of a `clean::Item`. This required also changing `FromClean` and `IntoJson` methods to take references, which required a lot of follow-on sigil wrangling that is mostly tedious.
2025-06-10Avoid cloning `self.index` in `after_krate`.Nicholas Nethercote-2/+4
It can be very big. This reduces peak memory usage for some `--output-format=json` runs by up to 8%.
2025-06-10Simplify `JsonRenderer`.Nicholas Nethercote-8/+7
- It doesn't need to be cloneable. - Some of the `Rc`s and `RefCell`s aren't doing anything. - `after_krate` can consume `self`.
2025-06-09-Zretpoline and -Zretpoline-external-thunk flags (target modifiers) to ↵Andrew Zhogin-2/+3
enable retpoline-related target features
2025-04-15rustdoc: Output target feature informationWill Glynn-0/+60
`#[target_feature]` attributes refer to a target-specific list of features. Enabling certain features can imply enabling other features. Certain features are always enabled on certain targets, since they are required by the target's ABI. Features can also be enabled indirectly based on other compiler flags. Feature information is ultimately known to `rustc`. Rather than force external tools to track it -- which may be wildly impractical due to `-C target-cpu` -- have `rustdoc` output `rustc`'s feature data.
2025-03-12rustdoc-json: Extract Id handling into its own moduleAlona Enraght-Moony-10/+2
I want to work on this in a followup commit, so in this commit I make it self-contained. Contains no code changes, all functions are defined exactly as they were in conversions.rs.
2025-02-08Rustfmtbjorn3-11/+17
2024-12-02rustdoc: Rename set_back_info to restore_module_data.Alona Enraght-Moony-5/+4
2024-12-01Rename `FormatRenderer::InfoType` into `ModuleData` and rename ↵Guillaume Gomez-4/+4
`FormatRenderer::make_child_renderer` into `save_module_data`
2024-12-01Add `unreachable!` in new `FormatRenderer` methods for `JsonRenderer` ↵Guillaume Gomez-2/+7
implementation
2024-12-01Stop cloning `Context` so muchGuillaume Gomez-3/+3
2024-11-28Fix new clippy lintsGuillaume Gomez-4/+4
2024-09-29rustdoc-json: `Id(String)` -> `Id(u32)`schvv31n-6/+17
2024-09-24Dogfood `feature(file_buffered)`Josh Stone-1/+1
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-22/+16
2024-09-09Auto merge of #129789 - notriddle:notriddle/inline-stmt-local, r=GuillaumeGomezbors-2/+2
rustdoc: use strategic boxing to shrink `clean::Item` * `inline_stmt_id` is never a cross-crate DefId, so save space by not storing it. * Instead of two inner boxes for `Item`, use one.
2024-09-07rustdoc: use a single box to store Attributes and ItemKindMichael Howell-2/+2
2024-09-01rustdoc: normalise type/field names in rustdoc-json-types/jsondoclintschvv31n-2/+2
2024-08-30Remove `#[macro_use] extern crate tracing` from rustdoc.Nicholas Nethercote-0/+1
2024-08-17rustdoc-json: Clean up serialization and printing.Alona Enraght-Moony-19/+23
2024-08-15rustdoc-json: Use FxHashMap from rustdoc_json_typesAlona Enraght-Moony-5/+5
2024-08-12Add possibility to generate rustdoc JSON output to stdoutGuillaume Gomez-16/+31
2024-08-05Rollup merge of #128385 - its-the-shrimp:fix_114039, r=aDotInTheVoidMatthias Krüger-6/+0
rustdoc-json: discard non-local inherent impls for primitives Fixes #114039 at least it should r? `@aDotInTheVoid`
2024-08-05rustdoc-json: discard non-local inherent implsschvv31n-6/+0
2024-08-01rustdoc: Remove OpaqueTyAlona Enraght-Moony-1/+0
2024-07-29Reformat `use` declarations.Nicholas Nethercote-1/+0
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-06-05Remove `Type` from rustdoc `Const`Boxy-1/+1
2023-11-15Re-format code with new rustfmtMark Rousskov-3/+3
2023-08-21rustdoc-json: Rename typedef to type aliasNoah Lev-1/+1
2023-08-16Improve code readability by moving fmt args directly into the stringGuillaume Gomez-3/+3
2023-04-26rustdoc-json: Time serialization.Alona Enraght-Moony-1/+4
2023-03-30Replace doc(primitive) with rustc_doc_primitiveGuillaume Gomez-1/+1
2023-02-18Improve code readabilityGuillaume Gomez-2/+2
2023-02-18Fix bad handling of primitive typesGuillaume Gomez-1/+1
2023-02-18Allow reexports of items with same name but different types to both appearGuillaume Gomez-9/+6
2023-02-15Use more let chainGuillaume Gomez-6/+5
2023-02-08Fix small debug typoGuillaume Gomez-1/+1
2023-01-22rustdoc: Use `DefId(Map,Set)` instead of `FxHash(Map,Set)`Vadim Petrochenkov-3/+3
Not all uses are converted, a few cases iterating through maps/sets and requiring nontrivial changes are kept.
2022-12-02Rustdoc-Json: Don't include foreign traitsNixon Enraght-Moony-52/+1
2022-12-01rustc_ast_lowering: Stop lowering imports into multiple itemsVadim Petrochenkov-1/+1
Lower them into a single item with multiple resolutions instead. This also allows to remove additional `NodId`s and `DefId`s related to those additional items.
2022-11-16rustdoc JSON: Use `Function` everywhere and remove `Method`Martin Nordholts-2/+1