| Age | Commit message (Collapse) | Author | Lines |
|
|
|
|
|
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).
|
|
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
|
|
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
|
|
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.
|
|
As per the previous commit, generic args here can only appear on the
final segment. So make the comments obey that constraint.
|
|
|
|
|
|
|
|
This minimizes the chance of two PRs changing it from N to N+1.
|
|
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>
|
|
|
|
|
|
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
|
|
|
|
|
|
`#[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.
|
|
|
|
|
|
|
|
|
|
|
|
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`
|
|
|
|
Closes https://github.com/rust-lang/rust/issues/135600
Effectivly reverts https://github.com/rust-lang/rust/pull/134880
|
|
|
|
|
|
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
|
|
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:
|
|
Typos found some typos in the file, so I fixed them c:
|
|
Fixes [rust-lang/rustdoc-types#26](https://github.com/rust-lang/rustdoc-types/issues/26)
|
|
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
|
|
This brings in the new algorithm.
|
|
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
|
|
|
|
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``
|
|
|
|
|
|
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.
|
|
|
|
|
|
"when to complex" should obviously be "too complex"
|
|
|
|
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% |
+-------------------------------------+------------+------------+------------+------------+
```
|
|
|
|
The previous commit updated `rustfmt.toml` appropriately. This commit is
the outcome of running `x fmt --all` with the new formatting options.
|
|
|
|
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
|
|
|