@@ -13,7 +13,7 @@ use serde::{Deserialize, Serialize};
13
13
/// This integer is incremented with every breaking change to the API,
14
14
/// and is returned along with the JSON blob as [`Crate::format_version`].
15
15
/// Consuming code should assert that this value matches the format version(s) that it supports.
16
- pub const FORMAT_VERSION : u32 = 33 ;
16
+ pub const FORMAT_VERSION : u32 = 34 ;
17
17
18
18
/// The root of the emitted JSON blob.
19
19
///
@@ -194,7 +194,7 @@ pub enum GenericArgs {
194
194
/// ```
195
195
args : Vec < GenericArg > ,
196
196
/// Associated type or constant bindings (e.g. `Item=i32` or `Item: Clone`) for this type.
197
- bindings : Vec < TypeBinding > ,
197
+ constraints : Vec < AssocItemConstraint > ,
198
198
} ,
199
199
/// `Fn(A, B) -> C`
200
200
Parenthesized {
@@ -258,19 +258,19 @@ pub struct Constant {
258
258
/// ^^^^^^^^^^ ^^^^^^^^^^^^^^^
259
259
/// ```
260
260
#[ derive( Clone , Debug , PartialEq , Eq , Hash , Serialize , Deserialize ) ]
261
- pub struct TypeBinding {
261
+ pub struct AssocItemConstraint {
262
262
/// The name of the associated type/constant.
263
263
pub name : String ,
264
264
/// Arguments provided to the associated type/constant.
265
265
pub args : GenericArgs ,
266
266
/// The kind of bound applied to the associated type/constant.
267
- pub binding : TypeBindingKind ,
267
+ pub binding : AssocItemConstraintKind ,
268
268
}
269
269
270
270
/// The way in which an associate type/constant is bound.
271
271
#[ derive( Clone , Debug , PartialEq , Eq , Hash , Serialize , Deserialize ) ]
272
272
#[ serde( rename_all = "snake_case" ) ]
273
- pub enum TypeBindingKind {
273
+ pub enum AssocItemConstraintKind {
274
274
/// The required value/type is specified exactly. e.g.
275
275
/// ```text
276
276
/// Iterator<Item = u32, IntoIter: DoubleEndedIterator>
@@ -311,7 +311,7 @@ pub enum ItemKind {
311
311
/// A crate imported via the `extern crate` syntax.
312
312
ExternCrate ,
313
313
/// An import of 1 or more items into scope, using the `use` keyword.
314
- Import ,
314
+ Use ,
315
315
/// A `struct` declaration.
316
316
Struct ,
317
317
/// A field of a struct.
@@ -341,7 +341,7 @@ pub enum ItemKind {
341
341
/// `type`s from an `extern` block.
342
342
///
343
343
/// See [the tracking issue](https://github.com/rust-lang/rust/issues/43467)
344
- ForeignType ,
344
+ ExternType ,
345
345
/// A macro declaration.
346
346
///
347
347
/// Corresponds to either `ItemEnum::Macro(_)`
@@ -386,7 +386,7 @@ pub enum ItemEnum {
386
386
rename : Option < String > ,
387
387
} ,
388
388
/// An import of 1 or more items into scope, using the `use` keyword.
389
- Import ( Import ) ,
389
+ Use ( Use ) ,
390
390
391
391
/// A `union` declaration.
392
392
Union ( Union ) ,
@@ -429,7 +429,7 @@ pub enum ItemEnum {
429
429
/// `type`s from an `extern` block.
430
430
///
431
431
/// See [the tracking issue](https://github.com/rust-lang/rust/issues/43467)
432
- ForeignType ,
432
+ ExternType ,
433
433
434
434
/// A macro_rules! declarative macro. Contains a single string with the source
435
435
/// representation of the macro with the patterns stripped.
@@ -447,12 +447,19 @@ pub enum ItemEnum {
447
447
/// The type of the constant.
448
448
#[ serde( rename = "type" ) ]
449
449
type_ : Type ,
450
- /// The stringified expression for the default value, if provided, e.g.
450
+ /// Inside a trait declaration, this is the default value for the associated constant,
451
+ /// if provided.
452
+ /// Inside an `impl` block, this is the value assigned to the associated constant,
453
+ /// and will always be present.
454
+ ///
455
+ /// The representation is implementation-defined and not guaranteed to be representative of
456
+ /// either the resulting value or of the source code.
457
+ ///
451
458
/// ```rust
452
459
/// const X: usize = 640 * 1024;
453
460
/// // ^^^^^^^^^^
454
461
/// ```
455
- default : Option < String > ,
462
+ value : Option < String > ,
456
463
} ,
457
464
/// An associated type of a trait or a type.
458
465
AssocType {
@@ -467,12 +474,16 @@ pub enum ItemEnum {
467
474
/// }
468
475
/// ```
469
476
bounds : Vec < GenericBound > ,
470
- /// The default for this type, if provided, e.g.
477
+ /// Inside a trait declaration, this is the default for the associated type, if provided.
478
+ /// Inside an impl block, this is the type assigned to the associated type, and will always
479
+ /// be present.
480
+ ///
471
481
/// ```rust
472
482
/// type X = usize;
473
483
/// // ^^^^^
474
484
/// ```
475
- default : Option < Type > ,
485
+ #[ serde( rename = "type" ) ]
486
+ type_ : Option < Type > ,
476
487
} ,
477
488
}
478
489
@@ -497,7 +508,7 @@ pub struct Union {
497
508
/// The generic parameters and where clauses on this union.
498
509
pub generics : Generics ,
499
510
/// Whether any fields have been removed from the result, due to being private or hidden.
500
- pub fields_stripped : bool ,
511
+ pub has_stripped_fields : bool ,
501
512
/// The list of fields in the union.
502
513
///
503
514
/// All of the corresponding [`Item`]s are of kind [`ItemEnum::StructField`].
@@ -554,7 +565,7 @@ pub enum StructKind {
554
565
/// All of the corresponding [`Item`]s are of kind [`ItemEnum::StructField`].
555
566
fields : Vec < Id > ,
556
567
/// Whether any fields have been removed from the result, due to being private or hidden.
557
- fields_stripped : bool ,
568
+ has_stripped_fields : bool ,
558
569
} ,
559
570
}
560
571
@@ -564,7 +575,7 @@ pub struct Enum {
564
575
/// Information about the type parameters and `where` clauses of the enum.
565
576
pub generics : Generics ,
566
577
/// Whether any variants have been removed from the result, due to being private or hidden.
567
- pub variants_stripped : bool ,
578
+ pub has_stripped_variants : bool ,
568
579
/// The list of variants in the enum.
569
580
///
570
581
/// All of the corresponding [`Item`]s are of kind [`ItemEnum::Variant`]
@@ -621,7 +632,7 @@ pub enum VariantKind {
621
632
/// All of the corresponding [`Item`]s are of kind [`ItemEnum::Variant`].
622
633
fields : Vec < Id > ,
623
634
/// Whether any variants have been removed from the result, due to being private or hidden.
624
- fields_stripped : bool ,
635
+ has_stripped_fields : bool ,
625
636
} ,
626
637
}
627
638
@@ -645,16 +656,13 @@ pub struct Discriminant {
645
656
646
657
/// A set of fundamental properties of a function.
647
658
#[ derive( Clone , Debug , PartialEq , Eq , Hash , Serialize , Deserialize ) ]
648
- pub struct Header {
659
+ pub struct FunctionHeader {
649
660
/// Is this function marked as `const`?
650
- #[ serde( rename = "const" ) ]
651
- pub const_ : bool ,
661
+ pub is_const : bool ,
652
662
/// Is this function unsafe?
653
- #[ serde( rename = "unsafe" ) ]
654
- pub unsafe_ : bool ,
663
+ pub is_unsafe : bool ,
655
664
/// Is this function async?
656
- #[ serde( rename = "async" ) ]
657
- pub async_ : bool ,
665
+ pub is_async : bool ,
658
666
/// The ABI used by the function.
659
667
pub abi : Abi ,
660
668
}
@@ -697,11 +705,11 @@ pub enum Abi {
697
705
#[ derive( Clone , Debug , PartialEq , Eq , Hash , Serialize , Deserialize ) ]
698
706
pub struct Function {
699
707
/// Information about the function signature, or declaration.
700
- pub decl : FnDecl ,
708
+ pub sig : FunctionSignature ,
701
709
/// Information about the function’s type parameters and `where` clauses.
702
710
pub generics : Generics ,
703
711
/// Information about core properties of the function, e.g. whether it's `const`, its ABI, etc.
704
- pub header : Header ,
712
+ pub header : FunctionHeader ,
705
713
/// Whether the function has a body, i.e. an implementation.
706
714
pub has_body : bool ,
707
715
}
@@ -784,7 +792,7 @@ pub enum GenericParamDefKind {
784
792
/// In this example, the generic parameter named `impl Trait` (and which
785
793
/// is bound by `Trait`) is synthetic, because it was not originally in
786
794
/// the Rust source text.
787
- synthetic : bool ,
795
+ is_synthetic : bool ,
788
796
} ,
789
797
790
798
/// Denotes a constant parameter.
@@ -894,7 +902,7 @@ pub enum TraitBoundModifier {
894
902
}
895
903
896
904
/// Either a type or a constant, usually stored as the right-hand side of an equation in places like
897
- /// [`TypeBinding `]
905
+ /// [`AssocItemConstraint `]
898
906
#[ derive( Clone , Debug , PartialEq , Eq , Hash , Serialize , Deserialize ) ]
899
907
#[ serde( rename_all = "snake_case" ) ]
900
908
pub enum Term {
@@ -963,7 +971,7 @@ pub enum Type {
963
971
/// A raw pointer type, e.g. `*mut u32`, `*const u8`, etc.
964
972
RawPointer {
965
973
/// This is `true` for `*mut _` and `false` for `*const _`.
966
- mutable : bool ,
974
+ is_mutable : bool ,
967
975
/// The type of the pointee.
968
976
#[ serde( rename = "type" ) ]
969
977
type_ : Box < Type > ,
@@ -973,7 +981,7 @@ pub enum Type {
973
981
/// The name of the lifetime of the reference, if provided.
974
982
lifetime : Option < String > ,
975
983
/// This is `true` for `&mut i32` and `false` for `&i32`
976
- mutable : bool ,
984
+ is_mutable : bool ,
977
985
/// The type of the pointee, e.g. the `i32` in `&'a mut i32`
978
986
#[ serde( rename = "type" ) ]
979
987
type_ : Box < Type > ,
@@ -1036,7 +1044,7 @@ pub struct Path {
1036
1044
#[ derive( Clone , Debug , PartialEq , Eq , Hash , Serialize , Deserialize ) ]
1037
1045
pub struct FunctionPointer {
1038
1046
/// The signature of the function.
1039
- pub decl : FnDecl ,
1047
+ pub sig : FunctionSignature ,
1040
1048
/// Used for Higher-Rank Trait Bounds (HRTBs)
1041
1049
///
1042
1050
/// ```ignore (incomplete expression)
@@ -1045,12 +1053,12 @@ pub struct FunctionPointer {
1045
1053
/// ```
1046
1054
pub generic_params : Vec < GenericParamDef > ,
1047
1055
/// The core properties of the function, such as the ABI it conforms to, whether it's unsafe, etc.
1048
- pub header : Header ,
1056
+ pub header : FunctionHeader ,
1049
1057
}
1050
1058
1051
1059
/// The signature of a function.
1052
1060
#[ derive( Clone , Debug , PartialEq , Eq , Hash , Serialize , Deserialize ) ]
1053
- pub struct FnDecl {
1061
+ pub struct FunctionSignature {
1054
1062
/// List of argument names and their type.
1055
1063
///
1056
1064
/// Note that not all names will be valid identifiers, as some of
@@ -1063,7 +1071,7 @@ pub struct FnDecl {
1063
1071
/// ```ignore (incomplete code)
1064
1072
/// fn printf(fmt: &str, ...);
1065
1073
/// ```
1066
- pub c_variadic : bool ,
1074
+ pub is_c_variadic : bool ,
1067
1075
}
1068
1076
1069
1077
/// A `trait` declaration.
@@ -1127,18 +1135,18 @@ pub struct Impl {
1127
1135
/// The list of associated items contained in this impl block.
1128
1136
pub items : Vec < Id > ,
1129
1137
/// Whether this is a negative impl (e.g. `!Sized` or `!Send`).
1130
- pub negative : bool ,
1138
+ pub is_negative : bool ,
1131
1139
/// Whether this is an impl that’s implied by the compiler
1132
1140
/// (for autotraits, e.g. `Send` or `Sync`).
1133
- pub synthetic : bool ,
1141
+ pub is_synthetic : bool ,
1134
1142
// FIXME: document this
1135
1143
pub blanket_impl : Option < Type > ,
1136
1144
}
1137
1145
1138
1146
/// A `use` statement.
1139
1147
#[ derive( Clone , Debug , PartialEq , Eq , Hash , Serialize , Deserialize ) ]
1140
1148
#[ serde( rename_all = "snake_case" ) ]
1141
- pub struct Import {
1149
+ pub struct Use {
1142
1150
/// The full path being imported.
1143
1151
pub source : String ,
1144
1152
/// May be different from the last segment of `source` when renaming imports:
@@ -1150,7 +1158,7 @@ pub struct Import {
1150
1158
/// ```
1151
1159
pub id : Option < Id > ,
1152
1160
/// Whether this statement is a wildcard `use`, e.g. `use source::*;`
1153
- pub glob : bool ,
1161
+ pub is_glob : bool ,
1154
1162
}
1155
1163
1156
1164
/// A procedural macro.
@@ -1205,7 +1213,7 @@ pub struct Static {
1205
1213
#[ serde( rename = "type" ) ]
1206
1214
pub type_ : Type ,
1207
1215
/// This is `true` for mutable statics, declared as `static mut X: T = f();`
1208
- pub mutable : bool ,
1216
+ pub is_mutable : bool ,
1209
1217
/// The stringified expression for the initial value.
1210
1218
///
1211
1219
/// It's not guaranteed that it'll match the actual source code for the initial value.
0 commit comments