about summary refs log tree commit diff
path: root/src/librustdoc/json
AgeCommit message (Collapse)AuthorLines
2025-03-26rustdoc: Rearrange `Item`/`ItemInner`.Nicholas Nethercote-1/+1
The `Item` struct is 48 bytes and contains a `Box<ItemInner>`; `ItemInner` is 104 bytes. This is an odd arrangement. Normally you'd have one of the following. - A single large struct, which avoids the allocation for the `Box`, but can result in lots of wasted space in unused parts of a container like `Vec<Item>`, `HashSet<Item>`, etc. - Or, something like `struct Item(Box<ItemInner>)`, which requires the `Box` allocation but gives a very small Item size, which is good for containers like `Vec<Item>`. `Item`/`ItemInner` currently gets the worst of both worlds: it always requires a `Box`, but `Item` is also pretty big and so wastes space in containers. It would make sense to push it in one direction or the other. #138916 showed that the first option is a regression for rustdoc, so this commit does the second option, which improves speed and reduces memory usage.
2025-03-15Add RTN support to rustdocMichael Goulet-0/+1
2025-03-13Auto merge of #138450 - matthiaskrgr:rollup-4im25vf, r=matthiaskrgrbors-1/+12
Rollup of 6 pull requests Successful merges: - #137816 (attempt to support `BinaryFormat::Xcoff` in `naked_asm!`) - #138109 (make precise capturing args in rustdoc Json typed) - #138343 (Enable `f16` tests for `powf`) - #138356 (bump libc to 0.2.171 to fix xous) - #138371 (Update compiletest's `has_asm_support` to match rustc) - #138404 (Cleanup sysroot locating a bit) r? `@ghost` `@rustbot` modify labels: rollup
2025-03-12rustdoc-json: Clean up & Document id handlingAlona Enraght-Moony-44/+85
Alot of the current id handling is weird and unnecessary. e.g: 1. The fully uninterned id type was (FullItemId, Option<FullItemId>) meaning it wasn't actually full! 2. None of the extra fields in Option<FullItemId> would ever be used 3. imported_item_id was a rustdoc_json_types::Id instead of a simpler DefId This commit removes the unnessessary complexity, and documents where the remaining complexity comes from. Co-authored-by: León Orell Valerian Liehr <me@fmease.dev>
2025-03-12rustdoc-json: Extract Id handling into its own moduleAlona Enraght-Moony-74/+85
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-03-10make precise capturing args in rustdoc Json typedmorine0122-1/+12
2025-02-18Move methods from `Map` to `TyCtxt`, part 2.Nicholas Nethercote-1/+1
Continuing the work started in #136466. Every method gains a `hir_` prefix, though for the ones that already have a `par_` or `try_par_` prefix I added the `hir_` after that.
2025-02-17Move some `Map` methods onto `TyCtxt`.Nicholas Nethercote-1/+1
The end goal is to eliminate `Map` altogether. I added a `hir_` prefix to all of them, that seemed simplest. The exceptions are `module_items` which became `hir_module_free_items` because there was already a `hir_module_items`, and `items` which became `hir_free_items` for consistency with `hir_module_free_items`.
2025-02-08Rustfmtbjorn3-11/+17
2025-01-29rustdoc: use ThinVec for generic arg partsMichael Howell-2/+2
This reduces the size of both these args, and of path segments, so should measurably help with memory use.
2025-01-22rustdoc-json: Rename `Path::name` to `path`, and give it path (again).Alona Enraght-Moony-1/+1
Closes https://github.com/rust-lang/rust/issues/135600 Effectivly reverts https://github.com/rust-lang/rust/pull/134880
2025-01-14Rollup merge of #134880 - as1100k-forks:fix-rustdoc-json-path-name, ↵Matthias Krüger-1/+1
r=aDotInTheVoid Made `Path::name` only have item name rather than full name Closes #134853 This PR makes `Path::name` to only have item name rather than full name, i.e. with the following code ```rust pub mod foo { pub struct Bar; } pub fn get_bar() -> foo::Bar { foo::Bar } ``` and running `./rustdoc ./demo.rs -wjson -Zunstable-options` gives: ```json { "41": { "id": 41, "name": "get_bar", "inner": { "function": { "sig": { "inputs": [], "output": { "resolved_path": { "name": "Bar", "id": 0, "args": { "angle_bracketed": { "args": [], "constraints": [] } } } } } } } } } ``` _Information which isn't useful here was trimmed_ r? aDotInTheVoid
2025-01-14Made `Path::name` only have item name rather than full nameAditya Kumar-1/+1
2024-12-31Unsafe binder support in rustdocMichael Goulet-1/+3
2024-12-25Improve rustdoc codeGuillaume Gomez-6/+5
2024-12-20Rollup merge of #134321 - dtolnay:docassocconst, r=fmeaseJacob Pratt-4/+6
Hide `= _` as associated constant value inside impl blocks Closes #134320. ### Before: <img src="https://github.com/user-attachments/assets/19d28811-45d2-4563-9726-f40c6af411c6" width="300">&nbsp;<img src="https://github.com/user-attachments/assets/1ecf8764-97ce-47f0-87fa-3b174d2fc578" width="300"> ### After: <img src="https://github.com/user-attachments/assets/6408c4ca-b1c4-42e4-884b-248833a4865f" width="300">&nbsp;<img src="https://github.com/user-attachments/assets/df2f6981-16f6-409f-8abb-73c0a4a71d6b" width="300"> r? `@fmease`
2024-12-19Rename TyMethodItem -> RequiredMethodItemDavid Tolnay-1/+3
2024-12-19Rename TyAssocTypeItem -> RequiredAssocTypeItemDavid Tolnay-1/+1
2024-12-19Split AssocConstItem into ProvidedAssocConstItem and ImplAssocConstItemDavid Tolnay-1/+1
2024-12-19Rename TyAssocConstItem -> RequiredAssocConstItemDavid Tolnay-1/+1
2024-12-16rename rustc_attr to rustc_attr_parsing and create rustc_attr_data_structuresJonathan Dönszelmann-3/+3
2024-12-14Add some convenience helper methods on `hir::Safety`Oli Scherer-4/+4
2024-12-04Rollup merge of #133764 - aDotInTheVoid:rename, r=GuillaumeGomezMatthias Krüger-5/+4
rustdoc: Rename `set_back_info` to `restore_module_data`. Follow-up to #133345, r? `@GuillaumeGomez` Most of the references to `info` got removed as it was clear that `module_data` makes more sense here. Makes it clearer that `save_module_data` and `restore_module_data` are a pair.
2024-12-02rustdoc: Rename set_back_info to restore_module_data.Alona Enraght-Moony-5/+4
2024-12-02Rollup merge of #133715 - aDotInTheVoid:rdj-static, r=GuillaumeGomezGuillaume Gomez-13/+16
rustdoc-json: Include safety of `static`s `static`s in an `extern` block can have an associated safety annotation ["because there is nothing guaranteeing that the bit pattern at the static’s memory is valid for the type it is declared with"](https://doc.rust-lang.org/reference/items/external-blocks.html#statics). Rustdoc already knows this and displays in for HTML. This PR also includes it in JSON. Inspired by https://github.com/obi1kenobi/cargo-semver-checks/issues/975 which needs this, but it's probably useful in other places. r? `@GuillaumeGomez.` Possibly easier to review commit-by-commit.
2024-12-01rustdoc-json: Include safety of `static`sAlona Enraght-Moony-13/+16
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-11-01rustdoc: Directly use rustc_abi instead of reexportsJubilee Young-11/+11
rustc_target reexports a lot of things that are in rustc_abi, but that will be over soon and now is probably a good time to switch. Uses of rustc_target remain where they inquire about the target tuple.
2024-10-22Represent TraitBoundModifiers as distinct parts in HIRMichael Goulet-13/+11
2024-10-16rustdoc-JSON: Rename "object safe" to "dyn compatible"León Orell Valerian Liehr-2/+2
2024-10-16rustdoc: Rename "object safe" to "dyn compatible"León Orell Valerian Liehr-1/+1
2024-09-29rustdoc-json: `Id(String)` -> `Id(u32)`schvv31n-308/+305
2024-09-24Dogfood `feature(file_buffered)`Josh Stone-1/+1
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-23/+17
2024-09-09Auto merge of #129789 - notriddle:notriddle/inline-stmt-local, r=GuillaumeGomezbors-6/+6
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-6/+6
2024-09-01rustdoc: normalise type/field names in rustdoc-json-types/jsondoclintschvv31n-54/+52
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-04rustdoc: Create `SelfTy` to replace `Generic(kw::SelfUpper)`Noah Lev-1/+3
Rustdoc often has to special-case `Self` because it is, well, a special type of generic parameter (although it also behaves as an alias in concrete impls). Instead of spreading this special-casing throughout the code base, create a new variant of the `clean::Type` enum that is for `Self` types. This is a refactoring that has almost no impact on rustdoc's behavior, except that `&Self`, `(Self,)`, `&[Self]`, and other similar occurrences of `Self` no longer link to the wrapping type (reference primitive, tuple primitive, etc.) as regular generics do. I felt this made more sense since users would expect `Self` to link to the containing trait or aliased type (though those are usually expanded), not the primitive that is wrapping it. For an example of the change, see the docs for `std::alloc::Allocator::by_ref`.
2024-08-01rustdoc: Remove OpaqueTyAlona Enraght-Moony-9/+0
2024-07-29Reformat `use` declarations.Nicholas Nethercote-7/+4
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-27rustdoc: use strategic ThinVec/Box to shrink `clean::ItemKind`Michael Howell-5/+15