@@ -9,7 +9,7 @@ use std::path::PathBuf;
99use serde:: { Deserialize , Serialize } ;
1010
1111/// rustdoc format-version.
12- pub const FORMAT_VERSION : u32 = 16 ;
12+ pub const FORMAT_VERSION : u32 = 17 ;
1313
1414/// A `Crate` is the root of the emitted JSON blob. It contains all type/documentation information
1515/// about the language items in the local crate, as well as info about external items to allow
@@ -115,6 +115,35 @@ pub enum Visibility {
115115 } ,
116116}
117117
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+
118147#[ derive( Clone , Debug , PartialEq , Eq , Hash , Serialize , Deserialize ) ]
119148#[ serde( rename_all = "snake_case" ) ]
120149pub enum GenericArgs {
@@ -395,7 +424,7 @@ pub enum WherePredicate {
395424 type_ : Type ,
396425 bounds : Vec < GenericBound > ,
397426 /// Used for Higher-Rank Trait Bounds (HRTBs)
398- /// ```plain
427+ /// ```text
399428 /// where for<'a> &'a T: Iterator,"
400429 /// ^^^^^^^
401430 /// |
@@ -420,7 +449,7 @@ pub enum GenericBound {
420449 #[ serde( rename = "trait" ) ]
421450 trait_ : Type ,
422451 /// Used for Higher-Rank Trait Bounds (HRTBs)
423- /// ```plain
452+ /// ```text
424453 /// where F: for<'a, 'b> Fn(&'a u8, &'b u8)
425454 /// ^^^^^^^^^^^
426455 /// |
@@ -458,6 +487,7 @@ pub enum Type {
458487 args : Option < Box < GenericArgs > > ,
459488 param_names : Vec < GenericBound > ,
460489 } ,
490+ DynTrait ( DynTrait ) ,
461491 /// Parameterized types
462492 Generic ( String ) ,
463493 /// Fixed-size numeric types (plus int/usize/float), char, arrays, slices, and tuples
@@ -505,7 +535,7 @@ pub enum Type {
505535pub struct FunctionPointer {
506536 pub decl : FnDecl ,
507537 /// Used for Higher-Rank Trait Bounds (HRTBs)
508- /// ```plain
538+ /// ```text
509539 /// for<'c> fn(val: &'c i32) -> i32
510540 /// ^^^^^^^
511541 /// |
0 commit comments