about summary refs log tree commit diff
path: root/tests/rustdoc-json
AgeCommit message (Collapse)AuthorLines
2025-07-30rustdoc-json: Move `#[macro_export]` from `Other` to it's own variantAlona Enraght-Moony-2/+2
2025-07-30rustdoc-json: Add test for `#[macro_use]` attributeAlona Enraght-Moony-0/+40
2025-07-15rustdoc-json: Structured attributesAlona Enraght-Moony-57/+104
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-07-13Auto merge of #143617 - aDotInTheVoid:devdesktoptestattr, r=Mark-Simulacrumbors-2/+0
Run `tests/rustdoc-json/attrs/target_features` on all hosts. Makes it more convenient to test rustdoc on non x86_64. I mainly care about the aarch64 dev-desktops. This works because rustdoc uses all target features, not just that of the target.
2025-07-11fix typos in function names in the `target_feature` testFluid-3/+3
2025-07-10Add rustdoc JSON tests for `#[doc(hidden)]` handling of items.Predrag Gruevski-0/+36
2025-07-08Don't mark `#[target_feature]` safe fns as unsafe in rustdoc JSON.Predrag Gruevski-0/+23
2025-07-07Run `tests/rustdoc-json/attrs/target_features` on all hosts.Alona Enraght-Moony-2/+0
Makes it more convenient to test rustdoc on non x86_64. I mainly care about the aarch64 dev-desktops. This works because rustdoc uses all target features, not just that of the target.
2025-07-03Port `#[target_feature]` to the new attribute parsing infrastructureJonathan Brouwer-0/+17
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-06-29Port #[link_section] to the new attribute parsing infrastructureAnne Stijns-0/+15
2025-06-24Rollup merge of #142919 - aDotInTheVoid:cold-cold-attr-for-you, r=GuillaumeGomezGuillaume Gomez-0/+3
rustdoc-json: Add test for `#[cold]` Follow-up to https://github.com/rust-lang/rust/pull/142491 r? `@GuillaumeGomez` CC `@jdonszelmann`
2025-06-24Rollup merge of #142916 - aDotInTheVoid:you-can-trip-on-my-optimizer, ↵Guillaume Gomez-0/+13
r=GuillaumeGomez rustdoc-json: Add test for `#[optimize(..)]` Follow up to https://github.com/rust-lang/rust/pull/138291 CC `@jdonszelmann` r? `@GuillaumeGomez`
2025-06-24rustdoc-json: Keep empty generic args if parenthesizedMartin Nordholts-0/+3
Because in the case of for example pub fn my_fn3(f: impl FnMut()) {} we want to keep `()` even if it is empty since that matches e.g. Rust syntax requirements.
2025-06-23rustdoc-json: Add test for `#[cold]`Alona Enraght-Moony-0/+3
Follow-up to https://www.github.com/rust-lang/rust/pull/142491
2025-06-23rustdoc-json: Add test for `#[optimize(..)]`Alona Enraght-Moony-0/+13
Follow up to https://www.github.com/rust-lang/rust/pull/138291
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-2/+2
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: Fix handling of paths with no generic args.Nicholas Nethercote-1/+1
A path without generic args, like `Reader`, currently has JSON produced like this: ``` {"path":"Reader","id":286,"args":{"angle_bracketed":{"args":[],"constraints":[]}}} ``` Even though `types::Path::args` is `Option` and allows for "no args", instead it gets represented as "empty args". (More like `Reader<>` than `Reader`.) This is due to a problem in `clean::Path::from_clean`. It only produces `None` if the path is an empty string. This commit changes it to also produce `None` if there are no generic args. The example above becomes: ``` {"path":"Reader","id":286,"args":null} ``` I looked at a few examples and saw this reduce the size of the JSON output by 3-9%. The commit also adds an assertion that non-final segments don't have any generics; something the old code was implicitly relying on. Note: the original sin here is that `clean::PathSegment::args` is not an `Option`, unlike `{ast,hir}::PathSegment::args`. I want to fix that, but it can be done separately.
2025-06-21rustdoc_json: Add a test for some `GenericArgs` cases.Nicholas Nethercote-0/+20
2025-06-17fix clippyJana Dönszelmann-3/+3
2025-06-16rustdoc: `{Meta,Pointee,}Sized` in non-minicoreDavid Wood-4/+16
Some rustdoc tests are `no_core` and need to have `MetaSized` and `PointeeSized` added to them.
2025-06-09rustdoc-json: Rearrange deck chairs in ABI testingJubilee Young-24/+38
We move the vectorcall ABI tests into their own file which is now only run on x86-64, while replacing them with rust-cold ABI tests so that aarch64 hosts continue to test an unstable ABI. A better solution might be cross-compiling or something but I really don't have time for that right now.
2025-05-28Stabilise `repr128`beetrees-3/+0
2025-05-22rustdoc JSON: Don't apply `#[repr]` privacy heuristicsLeón Orell Valerian Liehr-37/+4
2025-05-21rustdoc-json: Remove false docs and add test for inline attributeAlona Enraght-Moony-0/+11
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-05-07rustdoc-json: Remove newlines from attributesAlona Enraght-Moony-12/+12
2025-05-03Improve hir pretty-printing of attributes.Nicholas Nethercote-12/+12
2025-04-21Rollup merge of #140076 - aDotInTheVoid:jsondocline, r=GuillaumeGomezChris Denton-1/+1
jsondocck: Require command is at start of line In one place we use `///``@``` instead of `//``@`.`` The test-runner allowed it, but it probably shouldn't. Ran into by ``@lolbinarycat`` in https://github.com/rust-lang/rust/pull/132748#issuecomment-2816469322: ``` error: unknown disambiguator `?(` ##[error] --> /checkout/tests/rustdoc-json/fns/return_type_alias.rs:3:25 | 3 | ///@ set foo = "$.index[?(``@.name=='Foo')].id"`` | ^^ | ``` Maybe it's also worth erroring on this like we added in #137103 r? ``@GuillaumeGomez``
2025-04-20jsondocck: Require command is at start of lineAlona Enraght-Moony-1/+1
2025-04-20rustdoc-json: Improve test for auto-trait implsAlona Enraght-Moony-2/+4
2025-04-18Add regression test for span 1-indexed checkGuillaume Gomez-2/+6
2025-04-15rustdoc: Output target feature informationWill Glynn-0/+132
`#[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-31rustdoc-json: Add test for #[automatically_derived] attributeAlona Enraght-Moony-0/+13
2025-03-22rustdoc: Use own logic to print `#[repr(..)]` attributes in JSON output.Predrag Gruevski-31/+47
2025-03-21tests/rustdoc-json: change assertions to use RFC 9535 jsonpathAlona Enraght-Moony-25/+25
2025-03-21tests/rustdoc-json: replace `$.paths[*][?` with `$.paths[?`Alona Enraght-Moony-6/+6
This fixes all 3 of these tests. Done automatically in VSCode.
2025-03-21tests/rustdoc-json: replace `$.index[*][?` with `$.index[?`Alona Enraght-Moony-1155/+1155
Done automatically with VSCode.
2025-03-18Rollup merge of #138569 - aDotInTheVoid:reprdoc-json, r=GuillaumeGomezMatthias Krüger-0/+163
rustdoc-json: Add tests for `#[repr(...)]` Works towards #137645 and #81359 Based on #138018, but with only the test changes. CC ```@obi1kenobi``` r? ```@GuillaumeGomez```
2025-03-16rustdoc-json: Don't also include `#[deprecated]` in `Item::attrs`Alona Enraght-Moony-8/+8
2025-03-16rustdoc-json: Add tests for `#[deprecated(...)]`Alona Enraght-Moony-0/+38
2025-03-16rustdoc-json: Add tests for `#[repr(...)]`Alona Enraght-Moony-0/+163
Co-authored-by: Predrag Gruevski <obi1kenobi82@gmail.com>
2025-03-15Add RTN support to rustdocMichael Goulet-0/+18
2025-03-13Rollup merge of #138109 - Kohei316:feat/rust-doc-precise-capturing-arg, ↵Matthias Krüger-3/+3
r=aDotInTheVoid,compiler-errors make precise capturing args in rustdoc Json typed close #137616 This PR includes below changes. - Add `rustc_hir::PreciseCapturingArgKind` which allows the query system to return a arg's data. - Add `rustdoc::clean::types::PreciseCapturingArg` and change to use it. - Add `rustdoc-json-types::PreciseCapturingArg` and change to use it. - Update `tests/rustdoc-json/impl-trait-precise-capturing.rs`. - Bump `rustdoc_json_types::FORMAT_VERSION`.
2025-03-10make precise capturing args in rustdoc Json typedmorine0122-3/+3
2025-03-10Fix pretty printing of parsed attrs in hir_prettyMichael Goulet-2/+2
2025-03-05rustdoc: Add attribute-related tests for rustdoc JSON.Predrag Gruevski-0/+58
2025-03-03Always allow rustdoc-json tests to contain long linesNoratrieb-72/+0
The rustdoc-json test syntax often requires very long lines, so the checks for long lines aren't really useful.
2025-02-24Fix rustdoc and clippyJana Dönszelmann-2/+2
2025-02-04Add missing lang items in no_core tests in rustdocMichael Goulet-1/+4
2025-01-22rustdoc-json: Rename `Path::name` to `path`, and give it path (again).Alona Enraght-Moony-15/+110
Closes https://github.com/rust-lang/rust/issues/135600 Effectivly reverts https://github.com/rust-lang/rust/pull/134880