@@ -9,7 +9,7 @@ use std::path::PathBuf;
9
9
use serde:: { Deserialize , Serialize } ;
10
10
11
11
/// rustdoc format-version.
12
- pub const FORMAT_VERSION : u32 = 16 ;
12
+ pub const FORMAT_VERSION : u32 = 17 ;
13
13
14
14
/// A `Crate` is the root of the emitted JSON blob. It contains all type/documentation information
15
15
/// about the language items in the local crate, as well as info about external items to allow
@@ -115,6 +115,35 @@ pub enum Visibility {
115
115
} ,
116
116
}
117
117
118
+ #[ derive( Clone , Debug , PartialEq , Eq , Hash , Serialize , Deserialize ) ]
119
+ pub struct DynTrait {
120
+ /// All the traits implemented. One of them is the vtable, and the rest must be auto traits.
121
+ pub traits : Vec < PolyTrait > ,
122
+ /// The lifetime of the whole dyn object
123
+ /// ```text
124
+ /// dyn Debug + 'static
125
+ /// ^^^^^^^
126
+ /// |
127
+ /// this part
128
+ /// ```
129
+ pub lifetime : Option < String > ,
130
+ }
131
+
132
+ #[ derive( Clone , Debug , PartialEq , Eq , Hash , Serialize , Deserialize ) ]
133
+ /// A trait and potential HRTBs
134
+ pub struct PolyTrait {
135
+ #[ serde( rename = "trait" ) ]
136
+ pub trait_ : Type ,
137
+ /// Used for Higher-Rank Trait Bounds (HRTBs)
138
+ /// ```text
139
+ /// dyn for<'a> Fn() -> &'a i32"
140
+ /// ^^^^^^^
141
+ /// |
142
+ /// this part
143
+ /// ```
144
+ pub generic_params : Vec < GenericParamDef > ,
145
+ }
146
+
118
147
#[ derive( Clone , Debug , PartialEq , Eq , Hash , Serialize , Deserialize ) ]
119
148
#[ serde( rename_all = "snake_case" ) ]
120
149
pub enum GenericArgs {
@@ -395,7 +424,7 @@ pub enum WherePredicate {
395
424
type_ : Type ,
396
425
bounds : Vec < GenericBound > ,
397
426
/// Used for Higher-Rank Trait Bounds (HRTBs)
398
- /// ```plain
427
+ /// ```text
399
428
/// where for<'a> &'a T: Iterator,"
400
429
/// ^^^^^^^
401
430
/// |
@@ -420,7 +449,7 @@ pub enum GenericBound {
420
449
#[ serde( rename = "trait" ) ]
421
450
trait_ : Type ,
422
451
/// Used for Higher-Rank Trait Bounds (HRTBs)
423
- /// ```plain
452
+ /// ```text
424
453
/// where F: for<'a, 'b> Fn(&'a u8, &'b u8)
425
454
/// ^^^^^^^^^^^
426
455
/// |
@@ -458,6 +487,7 @@ pub enum Type {
458
487
args : Option < Box < GenericArgs > > ,
459
488
param_names : Vec < GenericBound > ,
460
489
} ,
490
+ DynTrait ( DynTrait ) ,
461
491
/// Parameterized types
462
492
Generic ( String ) ,
463
493
/// Fixed-size numeric types (plus int/usize/float), char, arrays, slices, and tuples
@@ -505,7 +535,7 @@ pub enum Type {
505
535
pub struct FunctionPointer {
506
536
pub decl : FnDecl ,
507
537
/// Used for Higher-Rank Trait Bounds (HRTBs)
508
- /// ```plain
538
+ /// ```text
509
539
/// for<'c> fn(val: &'c i32) -> i32
510
540
/// ^^^^^^^
511
541
/// |
0 commit comments