about summary refs log tree commit diff
path: root/src/rustdoc-json-types
AgeCommit message (Collapse)AuthorLines
2025-08-28Add new `doc(attribute = "...")` attributeGuillaume Gomez-2/+7
2025-07-30rustdoc-json: Move `#[macro_export]` from `Other` to it's own variantAlona Enraght-Moony-2/+5
2025-07-15rustdoc-json: Structured attributesAlona Enraght-Moony-4/+85
Implements https://www.github.com/rust-lang/rust/issues/141358. This has 2 primary benefits: 1. For rustdoc-json consumers, they no longer need to parse strings of attributes, but it's there in a structured and normalized way. 2. For rustc contributors, the output of HIR pretty printing is no longer a versioned thing in the output. People can work on https://github.com/rust-lang/rust/issues/131229 without needing to bump `FORMAT_VERSION`. (Over time, as the attribute refractor continues, I expect we'll add new things to `rustdoc_json_types::Attribute`. But this can be done separately to the rustc changes).
2025-06-22Port `#[no_mangle]` to new attribute parsing infrastructureJonathan Brouwer-2/+2
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-06-22Port `#[must_use]` to new attribute parsing infrastructureJonathan Brouwer-2/+2
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-06-21rustdoc_json: represent generic args consistently.Nicholas Nethercote-4/+4
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-21Fix some comments.Nicholas Nethercote-3/+3
As per the previous commit, generic args here can only appear on the final segment. So make the comments obey that constraint.
2025-06-20expected word diagnostic testJana Dönszelmann-2/+2
2025-06-18bump rustdoc json format number for pretty print change of attributeJana Dönszelmann-2/+2
2025-06-17bump rustdoc json version for inline attribute representation Jana Dönszelmann-2/+2
2025-06-17Add a comment to `FORMAT_VERSION`.Nicholas Nethercote-0/+8
This minimizes the chance of two PRs changing it from N to N+1.
2025-06-03rustdoc-json-type: Depend on `serde` and `serde_derive` seperatelyAlona Enraght-Moony-2/+3
Before this commit, serde_derive is built before serde. But serde does not depend on serde_derive, so that is not needed. Instead, build serde and serde_derive in parallel. This speeds up compilation for users depending on rustdoc-json-types out of tree. Imports: https://www.github.com/rust-lang/rustdoc-types/pull/49 Co-authored-by: Martin Nordholts <martin.nordholts@codetale.se>
2025-06-02[rustdoc-json] Implement PartialOrd and Ord for rustdoc_types::IdLuca Palmieri-1/+1
2025-05-22rustdoc JSON: Don't apply `#[repr]` privacy heuristicsLeón Orell Valerian Liehr-1/+1
2025-05-21rustdoc-json: Remove false docs and add test for inline attributeAlona Enraght-Moony-7/+1
The docs about how `#[inline]` was represented isn't true. Updates the comment, and adds a test. CC https://www.github.com/rust-lang/rust/issues/137645
2025-04-18Update rustdoc-json-types `FORMAT_VERSION` to 45Guillaume Gomez-1/+1
2025-04-18Make rustdoc JSON Span column 1-based, just like line numbersGuillaume Gomez-2/+2
2025-04-15rustdoc: Output target feature informationWill Glynn-1/+57
`#[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-22rustdoc: Use own logic to print `#[repr(..)]` attributes in JSON output.Predrag Gruevski-4/+18
2025-03-15Add RTN support to rustdocMichael Goulet-1/+3
2025-03-10make precise capturing args in rustdoc Json typedmorine0122-2/+18
2025-02-24Fix rustdoc and clippyJana Dönszelmann-2/+4
2025-02-01rustdoc-json-types: Document that crate name isn't package name.Alona Enraght-Moony-0/+7
2025-01-24Rollup merge of #135799 - aDotInTheVoid:skrrt-skrrt-revrrt, r=GuillaumeGomezMatthias Krüger-8/+12
rustdoc-json: Rename `Path::name` to `path`, and give it the path again. Closes: #135600. Reverts #134880 (Effectively, but not actually, as the `FORMAT_VERSION` needs to be bumped, changed docs/tests). CC `@AS1100K.` Also CC `@obi1kenobi` `@LukeMathWalker` Still needs before being merge-ready: - [x] Tests for cross-crate paths - [x] (Maybe) Document what the field does. - [x] Decide if the field rename is good (https://github.com/rust-lang/rust/pull/135799#issuecomment-2605937831) - [ ] Squash commits. r? `@GuillaumeGomez`
2025-01-22rustdoc-json-types: Finalize dyn compatibility renamingAlona Enraght-Moony-2/+1
2025-01-22rustdoc-json: Rename `Path::name` to `path`, and give it path (again).Alona Enraght-Moony-8/+12
Closes https://github.com/rust-lang/rust/issues/135600 Effectivly reverts https://github.com/rust-lang/rust/pull/134880
2025-01-14Made `Path::name` only have item name rather than full nameAditya Kumar-1/+1
2024-12-01rustdoc-json: Include safety of `static`sAlona Enraght-Moony-1/+17
2024-10-20Auto merge of #131980 - matthiaskrgr:rollup-iy5nw71, r=matthiaskrgrbors-7/+19
Rollup of 5 pull requests Successful merges: - #131814 (`optimize` attribute applied to things other than methods/functions/c…) - #131927 (Check for filecheck directives in files marked `skip-filecheck`) - #131967 (Remove `lower_mono_bounds`) - #131973 (fix(rustdoc-json-types): document rustc-hash feature) - #131976 (feat(rustdoc-json-types): mark simple enums as copy) r? `@ghost` `@rustbot` modify labels: rollup
2024-10-20Rollup merge of #131976 - jalil-salame:rustdoc-types-copy-enums, r=aDotInTheVoidMatthias Krüger-7/+7
feat(rustdoc-json-types): mark simple enums as copy Fixes rust-lang/rustdoc-types#26 and some typos in the documentation r? `@aDotInTheVoid` I have been assigning these PRs to you `@aDotInTheVoid,` is that okay? I think I'm out of PRs for now, but for future reference c:
2024-10-20fix(rustdoc-json-types): typosJalil David Salamé Messina-4/+4
Typos found some typos in the file, so I fixed them c:
2024-10-20feat(rustdoc-json-types): mark simple enums as copyJalil David Salamé Messina-3/+3
Fixes [rust-lang/rustdoc-types#26](https://github.com/rust-lang/rustdoc-types/issues/26)
2024-10-20fix(rustdoc-json-types): document rustc-hash featureJalil David Salamé Messina-0/+12
The `rustc-hash` feature is publicly exposed by the `rustdoc-types`. It is already documented in that crate's README and Cargo.toml, but we might as well add some information to the crate docs themselves c: Follow up to: - #131936 - [rust-lang/rustdoc-types#42][1] [1]: https://github.com/rust-lang/rustdoc-types/pull/42
2024-10-20Update rustc-hash to version 2Noratrieb-1/+1
This brings in the new algorithm.
2024-10-19feat(rustdoc-json-types): introduce rustc-hash featureJalil David Salamé Messina-6/+14
This allows the public `rustdoc-types` crate to expose this feature easily and allows consumers of the crate to get the performance advantages from doing so. The reasoning for this was discussed on [Zulip][1] Changes: - Make `rustc-hash` optional but default to including it - Rename all occurrences of `FxHashMap` to `HashMap`. - Feature gate the import and rename the imported `FxHashMap` to `HashMap` - Introduce a type alias `FxHashMap` which resolves to the currently used `HashMap` (`rustc_hash::FxHashMap` or `std::collections::HashMap`) for use in `src/librustdoc`. [1]: https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/rustc-hash.20and.20performance.20of.20rustdoc-types
2024-10-16rustdoc-JSON: Rename "object safe" to "dyn compatible"León Orell Valerian Liehr-3/+6
2024-10-11Rollup merge of #130078 - its-the-shrimp:rustdoc-types-compress-ids, ↵Trevor Gross-3/+3
r=aDotInTheVoid rustdoc-json: change item ID's repr from a string to an int Following [this discussion on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/266220-t-rustdoc/topic/Optimizing.20the.20.60Id.60.20type.20in.20.60rustdoc-types.60), I've changed the repr of `rustdoc_json_types::Id` from a String to a u32, by adding a `clean::ItemId` interner to `JsonRenderer` r? ``@aDotInTheVoid``
2024-10-10fix typo in rustdoc-json-types commentm-1/+1
2024-09-29rustdoc-json: `Id(String)` -> `Id(u32)`schvv31n-3/+3
2024-09-27rustdoc: update `ProcMacro` docs section on helper attributesPredrag Gruevski-1/+1
I believe the mention of attribute macros in the section on proc macro helper attributes is erroneous. As far as I can tell, attribute macros cannot define helper attributes. The following attribute macro is not valid (fails to build), no matter how I try to define (or skip defining) the helpers: ```rust #[proc_macro_attribute(attributes(helper))] pub fn attribute_helpers(_attr: TokenStream, item: TokenStream) -> TokenStream { item } ``` The [language reference](https://doc.rust-lang.org/reference/procedural-macros.html#attribute-macros) also doesn't seem to mention attribute macro helpers. The helpers subsection is inside the section on derive macros.
2024-09-01rustdoc: normalise type/field names in rustdoc-json-types/jsondoclintschvv31n-41/+49
2024-08-15rustdoc-json: Use FxHashMap from rustdoc_json_typesAlona Enraght-Moony-1/+1
2024-08-09rustdoc-json-types `Discriminant`: fix typokraktus-1/+1
"when to complex" should obviously be "too complex"
2024-08-01rustdoc: Remove OpaqueTyAlona Enraght-Moony-9/+1
2024-07-29Rollup merge of #127290 - its-the-shrimp:document_rustdoc_json_types, ↵Matthias Krüger-52/+533
r=aDotInTheVoid Fully document `rustdoc-json-types` 100% of `rustdoc-json-types` is now documented Here's the summary from rustdoc with `-Zunstable-options --show-coverage`: ``` +-------------------------------------+------------+------------+------------+------------+ | File | Documented | Percentage | Examples | Percentage | +-------------------------------------+------------+------------+------------+------------+ | src/rustdoc-json-types/lib.rs | 314 | 100.0% | 23 | 31.9% | +-------------------------------------+------------+------------+------------+------------+ | Total | 314 | 100.0% | 23 | 31.9% | +-------------------------------------+------------+------------+------------+------------+ ```
2024-07-29fully document rustdoc-json-typesschvv31n-52/+533
2024-07-29Reformat `use` declarations.Nicholas Nethercote-1/+2
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-12Add rustdoc-json support for use<>Michael Goulet-1/+3
2024-07-03rustdoc-json: Better representation of lifetime bounds in where clauses.Alona Enraght-Moony-3/+3
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-05Remove `Type` from rustdoc `Const`Boxy-4/+7