about summary refs log tree commit diff
path: root/src/librustdoc/json
AgeCommit message (Collapse)AuthorLines
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
2024-07-12Add rustdoc-json support for use<>Michael Goulet-0/+1
2024-07-03rustdoc-json: Better representation of lifetime bounds in where clauses.Alona Enraght-Moony-2/+9
As suggested [on zulip][1], there's no need to use `GenericBound` here, as the only bound a lifetime can have is that it outlives other lifetimes. While we're making breaking changes here, I also renamed it from using "region" to "lifetime", as this is more user-aligned. See [this comment][2] for details. [1]: https://rust-lang.zulipchat.com/#narrow/stream/266220-t-rustdoc/topic/.60ItemEnum.3A.3AOpaqueTy.60/near/448871430 [2]: https://github.com/rust-lang/rust/issues/100961#issuecomment-2206565556
2024-06-28implement new effects desugaringDeadbeef-9/+7
2024-06-20Implement `unsafe_extern_blocks` feature in rustdocGuillaume Gomez-2/+4
2024-06-05Remove `Type` from rustdoc `Const`Boxy-3/+6
2024-05-31Rollup merge of #125635 - fmease:mv-type-binding-assoc-item-constraint, ↵Matthias Krüger-11/+11
r=compiler-errors Rename HIR `TypeBinding` to `AssocItemConstraint` and related cleanup Rename `hir::TypeBinding` and `ast::AssocConstraint` to `AssocItemConstraint` and update all items and locals using the old terminology. Motivation: The terminology *type binding* is extremely outdated. "Type bindings" not only include constraints on associated *types* but also on associated *constants* (feature `associated_const_equality`) and on RPITITs of associated *functions* (feature `return_type_notation`). Hence the word *item* in the new name. Furthermore, the word *binding* commonly refers to a mapping from a binder/identifier to a "value" for some definition of "value". Its use in "type binding" made sense when equality constraints (e.g., `AssocTy = Ty`) were the only kind of associated item constraint. Nowadays however, we also have *associated type bounds* (e.g., `AssocTy: Bound`) for which the term *binding* doesn't make sense. --- Old terminology (HIR, rustdoc): ``` `TypeBinding`: (associated) type binding ├── `Constraint`: associated type bound └── `Equality`: (associated) equality constraint (?) ├── `Ty`: (associated) type binding └── `Const`: associated const equality (constraint) ``` Old terminology (AST, abbrev.): ``` `AssocConstraint` ├── `Bound` └── `Equality` ├── `Ty` └── `Const` ``` New terminology (AST, HIR, rustdoc): ``` `AssocItemConstraint`: associated item constraint ├── `Bound`: associated type bound └── `Equality`: associated item equality constraint OR associated item binding (for short) ├── `Ty`: associated type equality constraint OR associated type binding (for short) └── `Const`: associated const equality constraint OR associated const binding (for short) ``` r? compiler-errors
2024-05-30Rename HIR `TypeBinding` to `AssocItemConstraint` and related cleanupLeón Orell Valerian Liehr-11/+11
2024-05-29Make `body_owned_by` return the body directly.Oli Scherer-1/+4
Almost all callers want this anyway, and now we can use it to also return fed bodies