@@ -156,7 +156,7 @@ impl FromWithTcx<clean::GenericArgs> for GenericArgs {
156156match args {
157157AngleBracketed { args, constraints } => GenericArgs :: AngleBracketed {
158158args : args. into_vec ( ) . into_tcx ( tcx) ,
159- bindings : constraints. into_tcx ( tcx) ,
159+ constraints : constraints. into_tcx ( tcx) ,
160160} ,
161161Parenthesized { inputs, output } => GenericArgs :: Parenthesized {
162162inputs : inputs. into_vec ( ) . into_tcx ( tcx) ,
@@ -198,22 +198,22 @@ impl FromWithTcx<clean::ConstantKind> for Constant {
198198}
199199}
200200
201- impl FromWithTcx < clean:: AssocItemConstraint > for TypeBinding {
201+ impl FromWithTcx < clean:: AssocItemConstraint > for AssocItemConstraint {
202202fn from_tcx ( constraint : clean:: AssocItemConstraint , tcx : TyCtxt < ' _ > ) -> Self {
203- TypeBinding {
203+ AssocItemConstraint {
204204name : constraint. assoc . name . to_string ( ) ,
205205args : constraint. assoc . args . into_tcx ( tcx) ,
206206binding : constraint. kind . into_tcx ( tcx) ,
207207}
208208}
209209}
210210
211- impl FromWithTcx < clean:: AssocItemConstraintKind > for TypeBindingKind {
211+ impl FromWithTcx < clean:: AssocItemConstraintKind > for AssocItemConstraintKind {
212212fn from_tcx ( kind : clean:: AssocItemConstraintKind , tcx : TyCtxt < ' _ > ) -> Self {
213213use clean:: AssocItemConstraintKind :: * ;
214214match kind {
215- Equality { term } => TypeBindingKind :: Equality ( term. into_tcx ( tcx) ) ,
216- Bound { bounds } => TypeBindingKind :: Constraint ( bounds. into_tcx ( tcx) ) ,
215+ Equality { term } => AssocItemConstraintKind :: Equality ( term. into_tcx ( tcx) ) ,
216+ Bound { bounds } => AssocItemConstraintKind :: Constraint ( bounds. into_tcx ( tcx) ) ,
217217}
218218}
219219}
@@ -314,7 +314,7 @@ fn from_clean_item(item: clean::Item, tcx: TyCtxt<'_>) -> ItemEnum {
314314ModuleItem ( m) => {
315315ItemEnum :: Module ( Module { is_crate, items : ids ( m. items , tcx) , is_stripped : false } )
316316}
317- ImportItem ( i) => ItemEnum :: Import ( i. into_tcx ( tcx) ) ,
317+ ImportItem ( i) => ItemEnum :: Use ( i. into_tcx ( tcx) ) ,
318318StructItem ( s) => ItemEnum :: Struct ( s. into_tcx ( tcx) ) ,
319319UnionItem ( u) => ItemEnum :: Union ( u. into_tcx ( tcx) ) ,
320320StructFieldItem ( f) => ItemEnum :: StructField ( f. into_tcx ( tcx) ) ,
@@ -331,7 +331,7 @@ fn from_clean_item(item: clean::Item, tcx: TyCtxt<'_>) -> ItemEnum {
331331ImplItem ( i) => ItemEnum :: Impl ( ( * i) . into_tcx ( tcx) ) ,
332332StaticItem ( s) => ItemEnum :: Static ( s. into_tcx ( tcx) ) ,
333333ForeignStaticItem ( s, _) => ItemEnum :: Static ( s. into_tcx ( tcx) ) ,
334- ForeignTypeItem => ItemEnum :: ForeignType ,
334+ ForeignTypeItem => ItemEnum :: ExternType ,
335335TypeAliasItem ( t) => ItemEnum :: TypeAlias ( t. into_tcx ( tcx) ) ,
336336// FIXME(generic_const_items): Add support for generic free consts
337337ConstantItem ( ci) => {
@@ -347,21 +347,19 @@ fn from_clean_item(item: clean::Item, tcx: TyCtxt<'_>) -> ItemEnum {
347347}
348348// FIXME(generic_const_items): Add support for generic associated consts.
349349TyAssocConstItem ( _generics, ty) => {
350- ItemEnum :: AssocConst { type_ : ( * ty) . into_tcx ( tcx) , default : None }
350+ ItemEnum :: AssocConst { type_ : ( * ty) . into_tcx ( tcx) , value : None }
351351}
352352// FIXME(generic_const_items): Add support for generic associated consts.
353353AssocConstItem ( ci) => {
354- ItemEnum :: AssocConst { type_ : ci. type_ . into_tcx ( tcx) , default : Some ( ci. kind . expr ( tcx) ) }
354+ ItemEnum :: AssocConst { type_ : ci. type_ . into_tcx ( tcx) , value : Some ( ci. kind . expr ( tcx) ) }
355+ }
356+ TyAssocTypeItem ( g, b) => {
357+ ItemEnum :: AssocType { generics : g. into_tcx ( tcx) , bounds : b. into_tcx ( tcx) , type_ : None }
355358}
356- TyAssocTypeItem ( g, b) => ItemEnum :: AssocType {
357- generics : g. into_tcx ( tcx) ,
358- bounds : b. into_tcx ( tcx) ,
359- default : None ,
360- } ,
361359AssocTypeItem ( t, b) => ItemEnum :: AssocType {
362360generics : t. generics . into_tcx ( tcx) ,
363361bounds : b. into_tcx ( tcx) ,
364- default : Some ( t. item_type . unwrap_or ( t. type_ ) . into_tcx ( tcx) ) ,
362+ type_ : Some ( t. item_type . unwrap_or ( t. type_ ) . into_tcx ( tcx) ) ,
365363} ,
366364// `convert_item` early returns `None` for stripped items and keywords.
367365KeywordItem => unreachable ! ( ) ,
@@ -385,7 +383,7 @@ fn from_clean_item(item: clean::Item, tcx: TyCtxt<'_>) -> ItemEnum {
385383
386384impl FromWithTcx < clean:: Struct > for Struct {
387385fn from_tcx ( struct_ : clean:: Struct , tcx : TyCtxt < ' _ > ) -> Self {
388- let fields_stripped = struct_. has_stripped_entries ( ) ;
386+ let has_stripped_fields = struct_. has_stripped_entries ( ) ;
389387let clean:: Struct { ctor_kind, generics, fields } = struct_;
390388
391389let kind = match ctor_kind {
@@ -394,7 +392,7 @@ impl FromWithTcx<clean::Struct> for Struct {
394392assert ! ( fields. is_empty( ) ) ;
395393StructKind :: Unit
396394}
397- None => StructKind :: Plain { fields : ids ( fields, tcx) , fields_stripped } ,
395+ None => StructKind :: Plain { fields : ids ( fields, tcx) , has_stripped_fields } ,
398396} ;
399397
400398Struct {
@@ -407,22 +405,22 @@ impl FromWithTcx<clean::Struct> for Struct {
407405
408406impl FromWithTcx < clean:: Union > for Union {
409407fn from_tcx ( union_ : clean:: Union , tcx : TyCtxt < ' _ > ) -> Self {
410- let fields_stripped = union_. has_stripped_entries ( ) ;
408+ let has_stripped_fields = union_. has_stripped_entries ( ) ;
411409let clean:: Union { generics, fields } = union_;
412410Union {
413411generics : generics. into_tcx ( tcx) ,
414- fields_stripped ,
412+ has_stripped_fields ,
415413fields : ids ( fields, tcx) ,
416414impls : Vec :: new ( ) , // Added in JsonRenderer::item
417415}
418416}
419417}
420418
421- pub ( crate ) fn from_fn_header ( header : & rustc_hir:: FnHeader ) -> Header {
422- Header {
423- async_ : header. is_async ( ) ,
424- const_ : header. is_const ( ) ,
425- unsafe_ : header. is_unsafe ( ) ,
419+ pub ( crate ) fn from_fn_header ( header : & rustc_hir:: FnHeader ) -> FunctionHeader {
420+ FunctionHeader {
421+ is_async : header. is_async ( ) ,
422+ is_const : header. is_const ( ) ,
423+ is_unsafe : header. is_unsafe ( ) ,
426424abi : convert_abi ( header. abi ) ,
427425}
428426}
@@ -474,7 +472,7 @@ impl FromWithTcx<clean::GenericParamDefKind> for GenericParamDefKind {
474472Type { bounds, default, synthetic } => GenericParamDefKind :: Type {
475473bounds : bounds. into_tcx ( tcx) ,
476474default : default. map ( |x| ( * x) . into_tcx ( tcx) ) ,
477- synthetic,
475+ is_synthetic : synthetic,
478476} ,
479477Const { ty, default, synthetic : _ } => GenericParamDefKind :: Const {
480478type_ : ( * ty) . into_tcx ( tcx) ,
@@ -508,7 +506,7 @@ impl FromWithTcx<clean::WherePredicate> for WherePredicate {
508506. map ( |bound| bound. into_tcx ( tcx) )
509507. collect ( ) ,
510508default : default. map ( |ty| ( * ty) . into_tcx ( tcx) ) ,
511- synthetic,
509+ is_synthetic : synthetic,
512510}
513511}
514512 clean:: GenericParamDefKind :: Const { ty, default, synthetic : _ } => {
@@ -602,12 +600,12 @@ impl FromWithTcx<clean::Type> for Type {
602600ImplTrait ( g) => Type :: ImplTrait ( g. into_tcx ( tcx) ) ,
603601Infer => Type :: Infer ,
604602RawPointer ( mutability, type_) => Type :: RawPointer {
605- mutable : mutability == ast:: Mutability :: Mut ,
603+ is_mutable : mutability == ast:: Mutability :: Mut ,
606604type_ : Box :: new ( ( * type_) . into_tcx ( tcx) ) ,
607605} ,
608606BorrowedRef { lifetime, mutability, type_ } => Type :: BorrowedRef {
609607lifetime : lifetime. map ( convert_lifetime) ,
610- mutable : mutability == ast:: Mutability :: Mut ,
608+ is_mutable : mutability == ast:: Mutability :: Mut ,
611609type_ : Box :: new ( ( * type_) . into_tcx ( tcx) ) ,
612610} ,
613611QPath ( box clean:: QPathData { assoc, self_type, trait_, .. } ) => Type :: QualifiedPath {
@@ -643,29 +641,29 @@ impl FromWithTcx<clean::BareFunctionDecl> for FunctionPointer {
643641fn from_tcx ( bare_decl : clean:: BareFunctionDecl , tcx : TyCtxt < ' _ > ) -> Self {
644642let clean:: BareFunctionDecl { safety, generic_params, decl, abi } = bare_decl;
645643FunctionPointer {
646- header : Header {
647- unsafe_ : matches ! ( safety, rustc_hir:: Safety :: Unsafe ) ,
648- const_ : false ,
649- async_ : false ,
644+ header : FunctionHeader {
645+ is_unsafe : matches ! ( safety, rustc_hir:: Safety :: Unsafe ) ,
646+ is_const : false ,
647+ is_async : false ,
650648abi : convert_abi ( abi) ,
651649} ,
652650generic_params : generic_params. into_tcx ( tcx) ,
653- decl : decl. into_tcx ( tcx) ,
651+ sig : decl. into_tcx ( tcx) ,
654652}
655653}
656654}
657655
658- impl FromWithTcx < clean:: FnDecl > for FnDecl {
656+ impl FromWithTcx < clean:: FnDecl > for FunctionSignature {
659657fn from_tcx ( decl : clean:: FnDecl , tcx : TyCtxt < ' _ > ) -> Self {
660658let clean:: FnDecl { inputs, output, c_variadic } = decl;
661- FnDecl {
659+ FunctionSignature {
662660inputs : inputs
663661. values
664662. into_iter ( )
665663. map ( |arg| ( arg. name . to_string ( ) , arg. type_ . into_tcx ( tcx) ) )
666664. collect ( ) ,
667665output : if output. is_unit ( ) { None } else { Some ( output. into_tcx ( tcx) ) } ,
668- c_variadic,
666+ is_c_variadic : c_variadic,
669667}
670668}
671669}
@@ -702,12 +700,12 @@ impl FromWithTcx<clean::Impl> for Impl {
702700let provided_trait_methods = impl_. provided_trait_methods ( tcx) ;
703701let clean:: Impl { safety, generics, trait_, for_, items, polarity, kind } = impl_;
704702// FIXME: use something like ImplKind in JSON?
705- let ( synthetic , blanket_impl) = match kind {
703+ let ( is_synthetic , blanket_impl) = match kind {
706704 clean:: ImplKind :: Normal | clean:: ImplKind :: FakeVariadic => ( false , None ) ,
707705 clean:: ImplKind :: Auto => ( true , None ) ,
708706 clean:: ImplKind :: Blanket ( ty) => ( false , Some ( * ty) ) ,
709707} ;
710- let negative_polarity = match polarity {
708+ let is_negative = match polarity {
711709 ty:: ImplPolarity :: Positive | ty:: ImplPolarity :: Reservation => false ,
712710 ty:: ImplPolarity :: Negative => true ,
713711} ;
@@ -721,8 +719,8 @@ impl FromWithTcx<clean::Impl> for Impl {
721719trait_ : trait_. map ( |path| path. into_tcx ( tcx) ) ,
722720for_ : for_. into_tcx ( tcx) ,
723721items : ids ( items, tcx) ,
724- negative : negative_polarity ,
725- synthetic ,
722+ is_negative ,
723+ is_synthetic ,
726724blanket_impl : blanket_impl. map ( |x| x. into_tcx ( tcx) ) ,
727725}
728726}
@@ -736,7 +734,7 @@ pub(crate) fn from_function(
736734) -> Function {
737735let clean:: Function { decl, generics } = * function;
738736Function {
739- decl : decl. into_tcx ( tcx) ,
737+ sig : decl. into_tcx ( tcx) ,
740738generics : generics. into_tcx ( tcx) ,
741739header : from_fn_header ( & header) ,
742740 has_body,
@@ -745,11 +743,11 @@ pub(crate) fn from_function(
745743
746744impl FromWithTcx < clean:: Enum > for Enum {
747745fn from_tcx ( enum_ : clean:: Enum , tcx : TyCtxt < ' _ > ) -> Self {
748- let variants_stripped = enum_. has_stripped_entries ( ) ;
746+ let has_stripped_variants = enum_. has_stripped_entries ( ) ;
749747let clean:: Enum { variants, generics } = enum_;
750748Enum {
751749generics : generics. into_tcx ( tcx) ,
752- variants_stripped ,
750+ has_stripped_variants ,
753751variants : ids ( variants, tcx) ,
754752impls : Vec :: new ( ) , // Added in JsonRenderer::item
755753}
@@ -766,7 +764,7 @@ impl FromWithTcx<clean::Variant> for Variant {
766764CLike => VariantKind :: Plain ,
767765Tuple ( fields) => VariantKind :: Tuple ( ids_keeping_stripped ( fields, tcx) ) ,
768766Struct ( s) => VariantKind :: Struct {
769- fields_stripped : s. has_stripped_entries ( ) ,
767+ has_stripped_fields : s. has_stripped_entries ( ) ,
770768fields : ids ( s. fields , tcx) ,
771769} ,
772770} ;
@@ -787,21 +785,21 @@ impl FromWithTcx<clean::Discriminant> for Discriminant {
787785}
788786}
789787
790- impl FromWithTcx < clean:: Import > for Import {
788+ impl FromWithTcx < clean:: Import > for Use {
791789fn from_tcx ( import : clean:: Import , tcx : TyCtxt < ' _ > ) -> Self {
792790use clean:: ImportKind :: * ;
793- let ( name, glob ) = match import. kind {
791+ let ( name, is_glob ) = match import. kind {
794792Simple ( s) => ( s. to_string ( ) , false ) ,
795793Glob => (
796794 import. source . path . last_opt ( ) . unwrap_or_else ( || Symbol :: intern ( "*" ) ) . to_string ( ) ,
797795true ,
798796) ,
799797} ;
800- Import {
798+ Use {
801799source : import. source . path . whole_name ( ) ,
802800 name,
803801id : import. source . did . map ( ItemId :: from) . map ( |i| id_from_item_default ( i, tcx) ) ,
804- glob ,
802+ is_glob ,
805803}
806804}
807805}
@@ -835,7 +833,7 @@ impl FromWithTcx<clean::Static> for Static {
835833fn from_tcx ( stat : clean:: Static , tcx : TyCtxt < ' _ > ) -> Self {
836834Static {
837835type_ : ( * stat. type_ ) . into_tcx ( tcx) ,
838- mutable : stat. mutability == ast:: Mutability :: Mut ,
836+ is_mutable : stat. mutability == ast:: Mutability :: Mut ,
839837expr : stat
840838. expr
841839. map ( |e| rendered_const ( tcx, tcx. hir ( ) . body ( e) , tcx. hir ( ) . body_owner_def_id ( e) ) )
@@ -856,7 +854,7 @@ impl FromWithTcx<ItemType> for ItemKind {
856854match kind {
857855Module => ItemKind :: Module ,
858856ExternCrate => ItemKind :: ExternCrate ,
859- Import => ItemKind :: Import ,
857+ Import => ItemKind :: Use ,
860858Struct => ItemKind :: Struct ,
861859Union => ItemKind :: Union ,
862860Enum => ItemKind :: Enum ,
@@ -872,7 +870,7 @@ impl FromWithTcx<ItemType> for ItemKind {
872870Primitive => ItemKind :: Primitive ,
873871AssocConst => ItemKind :: AssocConst ,
874872AssocType => ItemKind :: AssocType ,
875- ForeignType => ItemKind :: ForeignType ,
873+ ForeignType => ItemKind :: ExternType ,
876874Keyword => ItemKind :: Keyword ,
877875TraitAlias => ItemKind :: TraitAlias ,
878876ProcAttribute => ItemKind :: ProcAttribute ,
0 commit comments