diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 34319bf..0c0dc90 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -13,7 +13,7 @@ jobs: cargo-test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable - uses: Swatinem/rust-cache@v2 - run: cargo test diff --git a/CHANGELOG.md b/CHANGELOG.md index 6cefc4c..226db13 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,18 @@ + +# [v0.30.0](https://github.com/aDotInTheVoid/rustdoc-types/releases/tag/v0.30.0) - 2024-09-11 + +**Breaking Change**: Renamed `TypeBinding`, `TypeBindingKind`, +`{ItemKind,ItemEnum}::{Import,ForeignType}`, `{Union,Enum}::fields_stripped`, +`Header`, `Header::{const, unsafe_, async_}`, +`{Function,FunctionPointer}::decl`, `GenericParamDefKind::synthetic`, `FnDecl`, +`FnDecl::c_variadic`, `Impl::{negative,synthetic}`, `Use::glob`, +`Static::mutable` +([rust#128667](https://github.com/rust-lang/rust/pull/128667)). + +- Format Version: 34 +- Upstream Commit: [`f2696ab4d3095bb6ad6197e55855ebdf00f50b80`](https://github.com/rust-lang/rust/commit/f2696ab4d3095bb6ad6197e55855ebdf00f50b80) +- Diff: [v0.29.1...v0.30.0](https://github.com/aDotInTheVoid/rustdoc-types/compare/v0.29.1...v0.30.0) + # [v0.29.1](https://github.com/aDotInTheVoid/rustdoc-types/releases/tag/v0.29.1) - 2024-08-13 @@ -10,7 +25,7 @@ # [v0.29.0](https://github.com/aDotInTheVoid/rustdoc-types/releases/tag/v0.29.0) - 2024-08-01 -> [!NOTE] +> [!NOTE] > Due to a mistake, this version was never published to crates.io. Users can use `v0.29.1` instead. **Breaking Change**: Removed `OpaqueTy`, `ItemKind::OpaqueTy` and `ItemEnum::OpaqueTy`. These were only generated with rarely used nightly features, so almost all documents will be uneffected ([rust#127276](https://github.com/rust-lang/rust/pull/127276)). @@ -94,7 +109,7 @@ people (and the reference) generally call these items. ([rust#115078](https://gi - Diff: [v0.23.0...v0.22.0](https://github.com/aDotInTheVoid/rustdoc-types/compare/v0.22.0...v0.23.0) -# [v0.22.0](https://github.com/aDotInTheVoid/rustdoc-types/releases/tag/v0.22.0) - 2023-05-23 +# [v0.22.0](https://github.com/aDotInTheVoid/rustdoc-types/releases/tag/v0.22.0) - 2023-05-23 **Breaking Change**: All enums now use external tagging. No change is required to move to this version (all all the types are the same), but it won't be able @@ -108,7 +123,7 @@ differently. This change allows using non-self-describing serde serializers - Diff: [v0.22.0...v0.21.0](https://github.com/aDotInTheVoid/rustdoc-types/compare/v0.21.0...v0.22.0) -# [v0.21.0](https://github.com/aDotInTheVoid/rustdoc-types/releases/tag/v0.21.0) - 2023-05-13 +# [v0.21.0](https://github.com/aDotInTheVoid/rustdoc-types/releases/tag/v0.21.0) - 2023-05-13 **Breaking Change**: `Type::QualifiedPath.trait_` is now an `Option` (instead of path). This is to support the (currently unstable) [inherent @@ -120,7 +135,7 @@ associated types](https://github.com/rust-lang/rust/issues/8995) feature. - Diff: [v0.21.0...v0.20.0](https://github.com/aDotInTheVoid/rustdoc-types/compare/v0.20.0...v0.21.0) -# [v0.20.0](https://github.com/aDotInTheVoid/rustdoc-types/releases/tag/v0.20.0) - 2023-01-03 +# [v0.20.0](https://github.com/aDotInTheVoid/rustdoc-types/releases/tag/v0.20.0) - 2023-01-03 **Breaking Change**: `Variant` has been split into `Variant` and `VariantKind`, so the `Discriminant` can always be reported. Previously, it could only be @@ -132,122 +147,121 @@ reported for a plain enum variant (i.e. one with no fields or braces). - Diff: [v0.20.0...v0.19.0](https://github.com/aDotInTheVoid/rustdoc-types/compare/v0.19.0...v0.20.0) -# [v0.19.0](https://github.com/aDotInTheVoid/rustdoc-types/releases/tag/v0.19.0) - 2022-11-21 +# [v0.19.0](https://github.com/aDotInTheVoid/rustdoc-types/releases/tag/v0.19.0) - 2022-11-21 - Format Version: 23 - Upstream Commit: [`30b7e44a3cabe1c21129253da54b21193f65ebe0`](https://github.com/rust-lang/rust/commit/30b7e44a3cabe1c21129253da54b21193f65ebe0) - Diff: [v0.19.0...v0.18.0](https://github.com/aDotInTheVoid/rustdoc-types/compare/v0.18.0...v0.19.0) -# [v0.18.0](https://github.com/aDotInTheVoid/rustdoc-types/releases/tag/v0.18.0) - 2022-09-27 +# [v0.18.0](https://github.com/aDotInTheVoid/rustdoc-types/releases/tag/v0.18.0) - 2022-09-27 - Format Version: 22 - Upstream Commit: [`aac7429c17aa558fbd9fb0be093e7bd9ccc73972`](https://github.com/rust-lang/rust/commit/aac7429c17aa558fbd9fb0be093e7bd9ccc73972) - Diff: [v0.18.0...v0.17.0](https://github.com/aDotInTheVoid/rustdoc-types/compare/v0.17.0...v0.18.0) -# [v0.17.0](https://github.com/aDotInTheVoid/rustdoc-types/releases/tag/v0.17.0) - 2022-09-08 +# [v0.17.0](https://github.com/aDotInTheVoid/rustdoc-types/releases/tag/v0.17.0) - 2022-09-08 - Format Version: 21 - Upstream Commit: [`1c8de173238a02abeb5642c25c3cef1eea52ac18`](https://github.com/rust-lang/rust/commit/1c8de173238a02abeb5642c25c3cef1eea52ac18) - Diff: [v0.17.0...v0.16.0](https://github.com/aDotInTheVoid/rustdoc-types/compare/v0.16.0...v0.17.0) -# [v0.16.0](https://github.com/aDotInTheVoid/rustdoc-types/releases/tag/v0.16.0) - 2022-09-07 +# [v0.16.0](https://github.com/aDotInTheVoid/rustdoc-types/releases/tag/v0.16.0) - 2022-09-07 - Format Version: 20 - Upstream Commit: [`065e0b9c9cf3d03f286c5d0b98fbae7185e41b75`](https://github.com/rust-lang/rust/commit/065e0b9c9cf3d03f286c5d0b98fbae7185e41b75) - Diff: [v0.16.0...v0.15.0](https://github.com/aDotInTheVoid/rustdoc-types/compare/v0.15.0...v0.16.0) -# [v0.15.0](https://github.com/aDotInTheVoid/rustdoc-types/releases/tag/v0.15.0) - 2022-09-05 +# [v0.15.0](https://github.com/aDotInTheVoid/rustdoc-types/releases/tag/v0.15.0) - 2022-09-05 - Format Version: 19 - Upstream Commit: [`b76a012be16de964c242594afba4323997f436b2`](https://github.com/rust-lang/rust/commit/b76a012be16de964c242594afba4323997f436b2) - Diff: [v0.15.0...v0.14.0](https://github.com/aDotInTheVoid/rustdoc-types/compare/v0.14.0...v0.15.0) -# [v0.14.0](https://github.com/aDotInTheVoid/rustdoc-types/releases/tag/v0.14.0) - 2022-08-15 +# [v0.14.0](https://github.com/aDotInTheVoid/rustdoc-types/releases/tag/v0.14.0) - 2022-08-15 - Format Version: 18 - Upstream Commit: [`4989f6a7247930ba027fa4b96a0c284f6ab02942`](https://github.com/rust-lang/rust/commit/4989f6a7247930ba027fa4b96a0c284f6ab02942) - Diff: [v0.14.0...v0.13.1](https://github.com/aDotInTheVoid/rustdoc-types/compare/v0.13.1...v0.14.0) -# [v0.13.1](https://github.com/aDotInTheVoid/rustdoc-types/releases/tag/v0.13.1) - 2022-08-10 +# [v0.13.1](https://github.com/aDotInTheVoid/rustdoc-types/releases/tag/v0.13.1) - 2022-08-10 - Format Version: 17 - Upstream Commit: [`0dc39c7bd9795927b903c8c24e89a00788ce3e33`](https://github.com/rust-lang/rust/commit/0dc39c7bd9795927b903c8c24e89a00788ce3e33) - Diff: [v0.13.1...v0.13.0](https://github.com/aDotInTheVoid/rustdoc-types/compare/v0.13.0...v0.13.1) -# [v0.13.0](https://github.com/aDotInTheVoid/rustdoc-types/releases/tag/v0.13.0) - 2022-08-09 +# [v0.13.0](https://github.com/aDotInTheVoid/rustdoc-types/releases/tag/v0.13.0) - 2022-08-09 - Format Version: 17 - Upstream Commit: [`a856e57f6cc8ba8bb83c5abadce338f589df6b10`](https://github.com/rust-lang/rust/commit/a856e57f6cc8ba8bb83c5abadce338f589df6b10) - Diff: [v0.13.0...v0.12.0](https://github.com/aDotInTheVoid/rustdoc-types/compare/v0.12.0...v0.13.0) -# [v0.12.0](https://github.com/aDotInTheVoid/rustdoc-types/releases/tag/v0.12.0) - 2022-07-18 +# [v0.12.0](https://github.com/aDotInTheVoid/rustdoc-types/releases/tag/v0.12.0) - 2022-07-18 - Format Version: 16 - Upstream Commit: [`1a15c7147f90afaa64ae3ff27fcbd678e2e44a8e`](https://github.com/rust-lang/rust/commit/1a15c7147f90afaa64ae3ff27fcbd678e2e44a8e) - Diff: [v0.12.0...v0.11.0](https://github.com/aDotInTheVoid/rustdoc-types/compare/v0.11.0...v0.12.0) -# [v0.11.0](https://github.com/aDotInTheVoid/rustdoc-types/releases/tag/v0.11.0) - 2022-05-18 +# [v0.11.0](https://github.com/aDotInTheVoid/rustdoc-types/releases/tag/v0.11.0) - 2022-05-18 - Format Version: 15 - Upstream Commit: [`1f15ce5f9748d523f3c1835da12b05b15648aa68`](https://github.com/rust-lang/rust/commit/1f15ce5f9748d523f3c1835da12b05b15648aa68) - Diff: [v0.11.0...v0.10.0](https://github.com/aDotInTheVoid/rustdoc-types/compare/v0.10.0...v0.11.0) -# [v0.10.0](https://github.com/aDotInTheVoid/rustdoc-types/releases/tag/v0.10.0) - 2022-03-14 +# [v0.10.0](https://github.com/aDotInTheVoid/rustdoc-types/releases/tag/v0.10.0) - 2022-03-14 - Format Version: 14 - Upstream Commit: [`a5c0b1470cc48e665eabf29881dd87438973ab97`](https://github.com/rust-lang/rust/commit/a5c0b1470cc48e665eabf29881dd87438973ab97) - Diff: [v0.10.0...v0.9.0](https://github.com/aDotInTheVoid/rustdoc-types/compare/v0.9.0...v0.10.0) -# [v0.9.0](https://github.com/aDotInTheVoid/rustdoc-types/releases/tag/v0.9.0) - 2022-03-12 +# [v0.9.0](https://github.com/aDotInTheVoid/rustdoc-types/releases/tag/v0.9.0) - 2022-03-12 - Format Version: 13 - Upstream Commit: [`aa763fcf421e627455aa1de16df1292c8e1bcb9d`](https://github.com/rust-lang/rust/commit/aa763fcf421e627455aa1de16df1292c8e1bcb9d) - Diff: [v0.9.0...v0.8.0](https://github.com/aDotInTheVoid/rustdoc-types/compare/v0.8.0...v0.9.0) -# [v0.8.0](https://github.com/aDotInTheVoid/rustdoc-types/releases/tag/v0.8.0) - 2022-03-04 +# [v0.8.0](https://github.com/aDotInTheVoid/rustdoc-types/releases/tag/v0.8.0) - 2022-03-04 - Format Version: 12 - Upstream Commit: [`aefc0a223a0022a156be07b18feb45cd07e517e0`](https://github.com/rust-lang/rust/commit/aefc0a223a0022a156be07b18feb45cd07e517e0) - Diff: [v0.8.0...v0.7.0](https://github.com/aDotInTheVoid/rustdoc-types/compare/v0.7.0...v0.8.0) -# [v0.7.0](https://github.com/aDotInTheVoid/rustdoc-types/releases/tag/v0.7.0) - 2022-02-24 +# [v0.7.0](https://github.com/aDotInTheVoid/rustdoc-types/releases/tag/v0.7.0) - 2022-02-24 - Format Version: 11 - Upstream Commit: [`aa601574a5fe861bffd641beccf59c7be3ed16c9`](https://github.com/rust-lang/rust/commit/aa601574a5fe861bffd641beccf59c7be3ed16c9) - Diff: [v0.7.0...v0.6.0](https://github.com/aDotInTheVoid/rustdoc-types/compare/v0.6.0...v0.7.0) -# [v0.6.0](https://github.com/aDotInTheVoid/rustdoc-types/releases/tag/v0.6.0) - 2022-02-01 +# [v0.6.0](https://github.com/aDotInTheVoid/rustdoc-types/releases/tag/v0.6.0) - 2022-02-01 - Format Version: 10 - Upstream Commit: [`1521b53c532ccd90c504b0c860cd5662172cc05e`](https://github.com/rust-lang/rust/commit/1521b53c532ccd90c504b0c860cd5662172cc05e) - Diff: [v0.6.0...v0.5.0](https://github.com/aDotInTheVoid/rustdoc-types/compare/v0.5.0...v0.6.0) -# [v0.5.0](https://github.com/aDotInTheVoid/rustdoc-types/releases/tag/v0.5.0) - 2021-10-16 +# [v0.5.0](https://github.com/aDotInTheVoid/rustdoc-types/releases/tag/v0.5.0) - 2021-10-16 - Format Version: 9 - Upstream Commit: [`43f4ef5c6a059c32e19483ff3d295feb2f37c5b8`](https://github.com/rust-lang/rust/commit/43f4ef5c6a059c32e19483ff3d295feb2f37c5b8) - Diff: [v0.5.0...v0.4.0](https://github.com/aDotInTheVoid/rustdoc-types/compare/v0.4.0...v0.5.0) -# [v0.4.0](https://github.com/aDotInTheVoid/rustdoc-types/releases/tag/v0.4.0) - 2021-09-06 +# [v0.4.0](https://github.com/aDotInTheVoid/rustdoc-types/releases/tag/v0.4.0) - 2021-09-06 - Format Version: 7 - Upstream Commit: [`2a6022949077176bfff9f72282dc52e51a175cb7`](https://github.com/rust-lang/rust/commit/2a6022949077176bfff9f72282dc52e51a175cb7) - Diff: [v0.4.0...v0.3](https://github.com/aDotInTheVoid/rustdoc-types/compare/v0.3...v0.4.0) -# [v0.3](https://github.com/aDotInTheVoid/rustdoc-types/releases/tag/v0.3) - 2021-06-25 +# [v0.3](https://github.com/aDotInTheVoid/rustdoc-types/releases/tag/v0.3) - 2021-06-25 - Format Version: 5 - Upstream Commit: [`6dff51f37d87eb02e8776032fa8da16c990a3283`](https://github.com/rust-lang/rust/commit/6dff51f37d87eb02e8776032fa8da16c990a3283) - Diff: [v0.3...v0.2.0](https://github.com/aDotInTheVoid/rustdoc-types/compare/v0.2.0...v0.3) -# [v0.2.0](https://github.com/aDotInTheVoid/rustdoc-types/releases/tag/v0.2.0) - 2021-01-23 +# [v0.2.0](https://github.com/aDotInTheVoid/rustdoc-types/releases/tag/v0.2.0) - 2021-01-23 - Format Version: 2 - Upstream Commit: [`2ceee724270f2186e5e85acff49acd35bf8a652a`](https://github.com/rust-lang/rust/commit/2ceee724270f2186e5e85acff49acd35bf8a652a) - Diff: [v0.2.0...v0.1.0](https://github.com/aDotInTheVoid/rustdoc-types/compare/v0.1.0...v0.2.0) -# [v0.1.0](https://github.com/aDotInTheVoid/rustdoc-types/releases/tag/v0.1.0) - 2020-12-06 +# [v0.1.0](https://github.com/aDotInTheVoid/rustdoc-types/releases/tag/v0.1.0) - 2020-12-06 - Format Version: 1 - Upstream Commit: [`7dc1e852d43cb8c9e77dc1e53014f0eb85d2ebfb`](https://github.com/rust-lang/rust/commit/7dc1e852d43cb8c9e77dc1e53014f0eb85d2ebfb) - Diff: [v0.1.0...](https://github.com/aDotInTheVoid/rustdoc-types/compare/...v0.1.0) - diff --git a/COMMIT.txt b/COMMIT.txt index dea2d9b..9f5c7d2 100644 --- a/COMMIT.txt +++ b/COMMIT.txt @@ -1 +1 @@ -9028b5381b2867bcd4d9cd0ba95ff97607deaaf3 +f2696ab4d3095bb6ad6197e55855ebdf00f50b80 diff --git a/Cargo.toml b/Cargo.toml index 39835d9..96e5023 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rustdoc-types" -version = "0.29.1" +version = "0.30.0" edition = "2018" license = "MIT OR Apache-2.0" description = "Types for rustdoc's json output" diff --git a/clgen.sh b/clgen.sh index 54f5b89..f413981 100755 --- a/clgen.sh +++ b/clgen.sh @@ -33,7 +33,7 @@ if [[ $(cat tmp | grep $new_version | wc -l) -ne 1 ]]; then fi mv tmp Cargo.toml -date=$(date --utc --rfc-3339=date) +date=$(date -u +'%Y-%m-%d') format_version=$(cat src/lib.rs | grepor FORMAT_VERSION | col6 | sd ";" "") rustc_commit=$(cat COMMIT.txt) diff --git a/src/lib.rs b/src/lib.rs index a785dd5..cfdcc04 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -13,7 +13,7 @@ use serde::{Deserialize, Serialize}; /// This integer is incremented with every breaking change to the API, /// and is returned along with the JSON blob as [`Crate::format_version`]. /// Consuming code should assert that this value matches the format version(s) that it supports. -pub const FORMAT_VERSION: u32 = 33; +pub const FORMAT_VERSION: u32 = 34; /// The root of the emitted JSON blob. /// @@ -194,7 +194,7 @@ pub enum GenericArgs { /// ``` args: Vec, /// Associated type or constant bindings (e.g. `Item=i32` or `Item: Clone`) for this type. - bindings: Vec, + constraints: Vec, }, /// `Fn(A, B) -> C` Parenthesized { @@ -258,19 +258,19 @@ pub struct Constant { /// ^^^^^^^^^^ ^^^^^^^^^^^^^^^ /// ``` #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] -pub struct TypeBinding { +pub struct AssocItemConstraint { /// The name of the associated type/constant. pub name: String, /// Arguments provided to the associated type/constant. pub args: GenericArgs, /// The kind of bound applied to the associated type/constant. - pub binding: TypeBindingKind, + pub binding: AssocItemConstraintKind, } /// The way in which an associate type/constant is bound. #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] -pub enum TypeBindingKind { +pub enum AssocItemConstraintKind { /// The required value/type is specified exactly. e.g. /// ```text /// Iterator @@ -311,7 +311,7 @@ pub enum ItemKind { /// A crate imported via the `extern crate` syntax. ExternCrate, /// An import of 1 or more items into scope, using the `use` keyword. - Import, + Use, /// A `struct` declaration. Struct, /// A field of a struct. @@ -341,7 +341,7 @@ pub enum ItemKind { /// `type`s from an `extern` block. /// /// See [the tracking issue](https://github.com/rust-lang/rust/issues/43467) - ForeignType, + ExternType, /// A macro declaration. /// /// Corresponds to either `ItemEnum::Macro(_)` @@ -386,7 +386,7 @@ pub enum ItemEnum { rename: Option, }, /// An import of 1 or more items into scope, using the `use` keyword. - Import(Import), + Use(Use), /// A `union` declaration. Union(Union), @@ -429,7 +429,7 @@ pub enum ItemEnum { /// `type`s from an `extern` block. /// /// See [the tracking issue](https://github.com/rust-lang/rust/issues/43467) - ForeignType, + ExternType, /// A macro_rules! declarative macro. Contains a single string with the source /// representation of the macro with the patterns stripped. @@ -447,12 +447,19 @@ pub enum ItemEnum { /// The type of the constant. #[serde(rename = "type")] type_: Type, - /// The stringified expression for the default value, if provided, e.g. + /// Inside a trait declaration, this is the default value for the associated constant, + /// if provided. + /// Inside an `impl` block, this is the value assigned to the associated constant, + /// and will always be present. + /// + /// The representation is implementation-defined and not guaranteed to be representative of + /// either the resulting value or of the source code. + /// /// ```rust /// const X: usize = 640 * 1024; /// // ^^^^^^^^^^ /// ``` - default: Option, + value: Option, }, /// An associated type of a trait or a type. AssocType { @@ -467,12 +474,16 @@ pub enum ItemEnum { /// } /// ``` bounds: Vec, - /// The default for this type, if provided, e.g. + /// Inside a trait declaration, this is the default for the associated type, if provided. + /// Inside an impl block, this is the type assigned to the associated type, and will always + /// be present. + /// /// ```rust /// type X = usize; /// // ^^^^^ /// ``` - default: Option, + #[serde(rename = "type")] + type_: Option, }, } @@ -497,7 +508,7 @@ pub struct Union { /// The generic parameters and where clauses on this union. pub generics: Generics, /// Whether any fields have been removed from the result, due to being private or hidden. - pub fields_stripped: bool, + pub has_stripped_fields: bool, /// The list of fields in the union. /// /// All of the corresponding [`Item`]s are of kind [`ItemEnum::StructField`]. @@ -554,7 +565,7 @@ pub enum StructKind { /// All of the corresponding [`Item`]s are of kind [`ItemEnum::StructField`]. fields: Vec, /// Whether any fields have been removed from the result, due to being private or hidden. - fields_stripped: bool, + has_stripped_fields: bool, }, } @@ -564,7 +575,7 @@ pub struct Enum { /// Information about the type parameters and `where` clauses of the enum. pub generics: Generics, /// Whether any variants have been removed from the result, due to being private or hidden. - pub variants_stripped: bool, + pub has_stripped_variants: bool, /// The list of variants in the enum. /// /// All of the corresponding [`Item`]s are of kind [`ItemEnum::Variant`] @@ -621,7 +632,7 @@ pub enum VariantKind { /// All of the corresponding [`Item`]s are of kind [`ItemEnum::Variant`]. fields: Vec, /// Whether any variants have been removed from the result, due to being private or hidden. - fields_stripped: bool, + has_stripped_fields: bool, }, } @@ -645,16 +656,13 @@ pub struct Discriminant { /// A set of fundamental properties of a function. #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] -pub struct Header { +pub struct FunctionHeader { /// Is this function marked as `const`? - #[serde(rename = "const")] - pub const_: bool, + pub is_const: bool, /// Is this function unsafe? - #[serde(rename = "unsafe")] - pub unsafe_: bool, + pub is_unsafe: bool, /// Is this function async? - #[serde(rename = "async")] - pub async_: bool, + pub is_async: bool, /// The ABI used by the function. pub abi: Abi, } @@ -697,11 +705,11 @@ pub enum Abi { #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] pub struct Function { /// Information about the function signature, or declaration. - pub decl: FnDecl, + pub sig: FunctionSignature, /// Information about the function’s type parameters and `where` clauses. pub generics: Generics, /// Information about core properties of the function, e.g. whether it's `const`, its ABI, etc. - pub header: Header, + pub header: FunctionHeader, /// Whether the function has a body, i.e. an implementation. pub has_body: bool, } @@ -784,7 +792,7 @@ pub enum GenericParamDefKind { /// In this example, the generic parameter named `impl Trait` (and which /// is bound by `Trait`) is synthetic, because it was not originally in /// the Rust source text. - synthetic: bool, + is_synthetic: bool, }, /// Denotes a constant parameter. @@ -894,7 +902,7 @@ pub enum TraitBoundModifier { } /// Either a type or a constant, usually stored as the right-hand side of an equation in places like -/// [`TypeBinding`] +/// [`AssocItemConstraint`] #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] pub enum Term { @@ -963,7 +971,7 @@ pub enum Type { /// A raw pointer type, e.g. `*mut u32`, `*const u8`, etc. RawPointer { /// This is `true` for `*mut _` and `false` for `*const _`. - mutable: bool, + is_mutable: bool, /// The type of the pointee. #[serde(rename = "type")] type_: Box, @@ -973,7 +981,7 @@ pub enum Type { /// The name of the lifetime of the reference, if provided. lifetime: Option, /// This is `true` for `&mut i32` and `false` for `&i32` - mutable: bool, + is_mutable: bool, /// The type of the pointee, e.g. the `i32` in `&'a mut i32` #[serde(rename = "type")] type_: Box, @@ -1036,7 +1044,7 @@ pub struct Path { #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] pub struct FunctionPointer { /// The signature of the function. - pub decl: FnDecl, + pub sig: FunctionSignature, /// Used for Higher-Rank Trait Bounds (HRTBs) /// /// ```ignore (incomplete expression) @@ -1045,12 +1053,12 @@ pub struct FunctionPointer { /// ``` pub generic_params: Vec, /// The core properties of the function, such as the ABI it conforms to, whether it's unsafe, etc. - pub header: Header, + pub header: FunctionHeader, } /// The signature of a function. #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] -pub struct FnDecl { +pub struct FunctionSignature { /// List of argument names and their type. /// /// Note that not all names will be valid identifiers, as some of @@ -1063,7 +1071,7 @@ pub struct FnDecl { /// ```ignore (incomplete code) /// fn printf(fmt: &str, ...); /// ``` - pub c_variadic: bool, + pub is_c_variadic: bool, } /// A `trait` declaration. @@ -1127,10 +1135,10 @@ pub struct Impl { /// The list of associated items contained in this impl block. pub items: Vec, /// Whether this is a negative impl (e.g. `!Sized` or `!Send`). - pub negative: bool, + pub is_negative: bool, /// Whether this is an impl that’s implied by the compiler /// (for autotraits, e.g. `Send` or `Sync`). - pub synthetic: bool, + pub is_synthetic: bool, // FIXME: document this pub blanket_impl: Option, } @@ -1138,7 +1146,7 @@ pub struct Impl { /// A `use` statement. #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] -pub struct Import { +pub struct Use { /// The full path being imported. pub source: String, /// May be different from the last segment of `source` when renaming imports: @@ -1150,7 +1158,7 @@ pub struct Import { /// ``` pub id: Option, /// Whether this statement is a wildcard `use`, e.g. `use source::*;` - pub glob: bool, + pub is_glob: bool, } /// A procedural macro. @@ -1205,7 +1213,7 @@ pub struct Static { #[serde(rename = "type")] pub type_: Type, /// This is `true` for mutable statics, declared as `static mut X: T = f();` - pub mutable: bool, + pub is_mutable: bool, /// The stringified expression for the initial value. /// /// It's not guaranteed that it'll match the actual source code for the initial value. diff --git a/src/tests.rs b/src/tests.rs index 1126d5f..b9363fc 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -4,7 +4,7 @@ use super::*; fn test_struct_info_roundtrip() { let s = ItemEnum::Struct(Struct { generics: Generics { params: vec![], where_predicates: vec![] }, - kind: StructKind::Plain { fields: vec![], fields_stripped: false }, + kind: StructKind::Plain { fields: vec![], has_stripped_fields: false }, impls: vec![], }); @@ -23,7 +23,7 @@ fn test_struct_info_roundtrip() { fn test_union_info_roundtrip() { let u = ItemEnum::Union(Union { generics: Generics { params: vec![], where_predicates: vec![] }, - fields_stripped: false, + has_stripped_fields: false, fields: vec![], impls: vec![], });