@@ -156,7 +156,7 @@ impl FromWithTcx<clean::GenericArgs> for GenericArgs {
156
156
match args {
157
157
AngleBracketed { args, constraints } => GenericArgs :: AngleBracketed {
158
158
args : args. into_vec ( ) . into_tcx ( tcx) ,
159
- bindings : constraints. into_tcx ( tcx) ,
159
+ constraints : constraints. into_tcx ( tcx) ,
160
160
} ,
161
161
Parenthesized { inputs, output } => GenericArgs :: Parenthesized {
162
162
inputs : inputs. into_vec ( ) . into_tcx ( tcx) ,
@@ -198,22 +198,22 @@ impl FromWithTcx<clean::ConstantKind> for Constant {
198
198
}
199
199
}
200
200
201
- impl FromWithTcx < clean:: AssocItemConstraint > for TypeBinding {
201
+ impl FromWithTcx < clean:: AssocItemConstraint > for AssocItemConstraint {
202
202
fn from_tcx ( constraint : clean:: AssocItemConstraint , tcx : TyCtxt < ' _ > ) -> Self {
203
- TypeBinding {
203
+ AssocItemConstraint {
204
204
name : constraint. assoc . name . to_string ( ) ,
205
205
args : constraint. assoc . args . into_tcx ( tcx) ,
206
206
binding : constraint. kind . into_tcx ( tcx) ,
207
207
}
208
208
}
209
209
}
210
210
211
- impl FromWithTcx < clean:: AssocItemConstraintKind > for TypeBindingKind {
211
+ impl FromWithTcx < clean:: AssocItemConstraintKind > for AssocItemConstraintKind {
212
212
fn from_tcx ( kind : clean:: AssocItemConstraintKind , tcx : TyCtxt < ' _ > ) -> Self {
213
213
use clean:: AssocItemConstraintKind :: * ;
214
214
match 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) ) ,
217
217
}
218
218
}
219
219
}
@@ -314,7 +314,7 @@ fn from_clean_item(item: clean::Item, tcx: TyCtxt<'_>) -> ItemEnum {
314
314
ModuleItem ( m) => {
315
315
ItemEnum :: Module ( Module { is_crate, items : ids ( m. items , tcx) , is_stripped : false } )
316
316
}
317
- ImportItem ( i) => ItemEnum :: Import ( i. into_tcx ( tcx) ) ,
317
+ ImportItem ( i) => ItemEnum :: Use ( i. into_tcx ( tcx) ) ,
318
318
StructItem ( s) => ItemEnum :: Struct ( s. into_tcx ( tcx) ) ,
319
319
UnionItem ( u) => ItemEnum :: Union ( u. into_tcx ( tcx) ) ,
320
320
StructFieldItem ( f) => ItemEnum :: StructField ( f. into_tcx ( tcx) ) ,
@@ -331,7 +331,7 @@ fn from_clean_item(item: clean::Item, tcx: TyCtxt<'_>) -> ItemEnum {
331
331
ImplItem ( i) => ItemEnum :: Impl ( ( * i) . into_tcx ( tcx) ) ,
332
332
StaticItem ( s) => ItemEnum :: Static ( s. into_tcx ( tcx) ) ,
333
333
ForeignStaticItem ( s, _) => ItemEnum :: Static ( s. into_tcx ( tcx) ) ,
334
- ForeignTypeItem => ItemEnum :: ForeignType ,
334
+ ForeignTypeItem => ItemEnum :: ExternType ,
335
335
TypeAliasItem ( t) => ItemEnum :: TypeAlias ( t. into_tcx ( tcx) ) ,
336
336
// FIXME(generic_const_items): Add support for generic free consts
337
337
ConstantItem ( ci) => {
@@ -347,21 +347,19 @@ fn from_clean_item(item: clean::Item, tcx: TyCtxt<'_>) -> ItemEnum {
347
347
}
348
348
// FIXME(generic_const_items): Add support for generic associated consts.
349
349
TyAssocConstItem ( _generics, ty) => {
350
- ItemEnum :: AssocConst { type_ : ( * ty) . into_tcx ( tcx) , default : None }
350
+ ItemEnum :: AssocConst { type_ : ( * ty) . into_tcx ( tcx) , value : None }
351
351
}
352
352
// FIXME(generic_const_items): Add support for generic associated consts.
353
353
AssocConstItem ( 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 }
355
358
}
356
- TyAssocTypeItem ( g, b) => ItemEnum :: AssocType {
357
- generics : g. into_tcx ( tcx) ,
358
- bounds : b. into_tcx ( tcx) ,
359
- default : None ,
360
- } ,
361
359
AssocTypeItem ( t, b) => ItemEnum :: AssocType {
362
360
generics : t. generics . into_tcx ( tcx) ,
363
361
bounds : 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) ) ,
365
363
} ,
366
364
// `convert_item` early returns `None` for stripped items and keywords.
367
365
KeywordItem => unreachable ! ( ) ,
@@ -385,7 +383,7 @@ fn from_clean_item(item: clean::Item, tcx: TyCtxt<'_>) -> ItemEnum {
385
383
386
384
impl FromWithTcx < clean:: Struct > for Struct {
387
385
fn 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 ( ) ;
389
387
let clean:: Struct { ctor_kind, generics, fields } = struct_;
390
388
391
389
let kind = match ctor_kind {
@@ -394,7 +392,7 @@ impl FromWithTcx<clean::Struct> for Struct {
394
392
assert ! ( fields. is_empty( ) ) ;
395
393
StructKind :: Unit
396
394
}
397
- None => StructKind :: Plain { fields : ids ( fields, tcx) , fields_stripped } ,
395
+ None => StructKind :: Plain { fields : ids ( fields, tcx) , has_stripped_fields } ,
398
396
} ;
399
397
400
398
Struct {
@@ -407,22 +405,22 @@ impl FromWithTcx<clean::Struct> for Struct {
407
405
408
406
impl FromWithTcx < clean:: Union > for Union {
409
407
fn 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 ( ) ;
411
409
let clean:: Union { generics, fields } = union_;
412
410
Union {
413
411
generics : generics. into_tcx ( tcx) ,
414
- fields_stripped ,
412
+ has_stripped_fields ,
415
413
fields : ids ( fields, tcx) ,
416
414
impls : Vec :: new ( ) , // Added in JsonRenderer::item
417
415
}
418
416
}
419
417
}
420
418
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 ( ) ,
426
424
abi : convert_abi ( header. abi ) ,
427
425
}
428
426
}
@@ -474,7 +472,7 @@ impl FromWithTcx<clean::GenericParamDefKind> for GenericParamDefKind {
474
472
Type { bounds, default, synthetic } => GenericParamDefKind :: Type {
475
473
bounds : bounds. into_tcx ( tcx) ,
476
474
default : default. map ( |x| ( * x) . into_tcx ( tcx) ) ,
477
- synthetic,
475
+ is_synthetic : synthetic,
478
476
} ,
479
477
Const { ty, default, synthetic : _ } => GenericParamDefKind :: Const {
480
478
type_ : ( * ty) . into_tcx ( tcx) ,
@@ -508,7 +506,7 @@ impl FromWithTcx<clean::WherePredicate> for WherePredicate {
508
506
. map ( |bound| bound. into_tcx ( tcx) )
509
507
. collect ( ) ,
510
508
default : default. map ( |ty| ( * ty) . into_tcx ( tcx) ) ,
511
- synthetic,
509
+ is_synthetic : synthetic,
512
510
}
513
511
}
514
512
clean:: GenericParamDefKind :: Const { ty, default, synthetic : _ } => {
@@ -602,12 +600,12 @@ impl FromWithTcx<clean::Type> for Type {
602
600
ImplTrait ( g) => Type :: ImplTrait ( g. into_tcx ( tcx) ) ,
603
601
Infer => Type :: Infer ,
604
602
RawPointer ( mutability, type_) => Type :: RawPointer {
605
- mutable : mutability == ast:: Mutability :: Mut ,
603
+ is_mutable : mutability == ast:: Mutability :: Mut ,
606
604
type_ : Box :: new ( ( * type_) . into_tcx ( tcx) ) ,
607
605
} ,
608
606
BorrowedRef { lifetime, mutability, type_ } => Type :: BorrowedRef {
609
607
lifetime : lifetime. map ( convert_lifetime) ,
610
- mutable : mutability == ast:: Mutability :: Mut ,
608
+ is_mutable : mutability == ast:: Mutability :: Mut ,
611
609
type_ : Box :: new ( ( * type_) . into_tcx ( tcx) ) ,
612
610
} ,
613
611
QPath ( box clean:: QPathData { assoc, self_type, trait_, .. } ) => Type :: QualifiedPath {
@@ -643,10 +641,10 @@ impl FromWithTcx<clean::BareFunctionDecl> for FunctionPointer {
643
641
fn from_tcx ( bare_decl : clean:: BareFunctionDecl , tcx : TyCtxt < ' _ > ) -> Self {
644
642
let clean:: BareFunctionDecl { safety, generic_params, decl, abi } = bare_decl;
645
643
FunctionPointer {
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 ,
650
648
abi : convert_abi ( abi) ,
651
649
} ,
652
650
generic_params : generic_params. into_tcx ( tcx) ,
@@ -655,17 +653,17 @@ impl FromWithTcx<clean::BareFunctionDecl> for FunctionPointer {
655
653
}
656
654
}
657
655
658
- impl FromWithTcx < clean:: FnDecl > for FnDecl {
656
+ impl FromWithTcx < clean:: FnDecl > for FunctionSignature {
659
657
fn from_tcx ( decl : clean:: FnDecl , tcx : TyCtxt < ' _ > ) -> Self {
660
658
let clean:: FnDecl { inputs, output, c_variadic } = decl;
661
- FnDecl {
659
+ FunctionSignature {
662
660
inputs : inputs
663
661
. values
664
662
. into_iter ( )
665
663
. map ( |arg| ( arg. name . to_string ( ) , arg. type_ . into_tcx ( tcx) ) )
666
664
. collect ( ) ,
667
665
output : if output. is_unit ( ) { None } else { Some ( output. into_tcx ( tcx) ) } ,
668
- c_variadic,
666
+ is_c_variadic : c_variadic,
669
667
}
670
668
}
671
669
}
@@ -702,12 +700,12 @@ impl FromWithTcx<clean::Impl> for Impl {
702
700
let provided_trait_methods = impl_. provided_trait_methods ( tcx) ;
703
701
let clean:: Impl { safety, generics, trait_, for_, items, polarity, kind } = impl_;
704
702
// FIXME: use something like ImplKind in JSON?
705
- let ( synthetic , blanket_impl) = match kind {
703
+ let ( is_synthetic , blanket_impl) = match kind {
706
704
clean:: ImplKind :: Normal | clean:: ImplKind :: FakeVariadic => ( false , None ) ,
707
705
clean:: ImplKind :: Auto => ( true , None ) ,
708
706
clean:: ImplKind :: Blanket ( ty) => ( false , Some ( * ty) ) ,
709
707
} ;
710
- let negative_polarity = match polarity {
708
+ let is_negative = match polarity {
711
709
ty:: ImplPolarity :: Positive | ty:: ImplPolarity :: Reservation => false ,
712
710
ty:: ImplPolarity :: Negative => true ,
713
711
} ;
@@ -721,8 +719,8 @@ impl FromWithTcx<clean::Impl> for Impl {
721
719
trait_ : trait_. map ( |path| path. into_tcx ( tcx) ) ,
722
720
for_ : for_. into_tcx ( tcx) ,
723
721
items : ids ( items, tcx) ,
724
- negative : negative_polarity ,
725
- synthetic ,
722
+ is_negative ,
723
+ is_synthetic ,
726
724
blanket_impl : blanket_impl. map ( |x| x. into_tcx ( tcx) ) ,
727
725
}
728
726
}
@@ -745,11 +743,11 @@ pub(crate) fn from_function(
745
743
746
744
impl FromWithTcx < clean:: Enum > for Enum {
747
745
fn 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 ( ) ;
749
747
let clean:: Enum { variants, generics } = enum_;
750
748
Enum {
751
749
generics : generics. into_tcx ( tcx) ,
752
- variants_stripped ,
750
+ has_stripped_variants ,
753
751
variants : ids ( variants, tcx) ,
754
752
impls : Vec :: new ( ) , // Added in JsonRenderer::item
755
753
}
@@ -766,7 +764,7 @@ impl FromWithTcx<clean::Variant> for Variant {
766
764
CLike => VariantKind :: Plain ,
767
765
Tuple ( fields) => VariantKind :: Tuple ( ids_keeping_stripped ( fields, tcx) ) ,
768
766
Struct ( s) => VariantKind :: Struct {
769
- fields_stripped : s. has_stripped_entries ( ) ,
767
+ has_stripped_fields : s. has_stripped_entries ( ) ,
770
768
fields : ids ( s. fields , tcx) ,
771
769
} ,
772
770
} ;
@@ -787,21 +785,21 @@ impl FromWithTcx<clean::Discriminant> for Discriminant {
787
785
}
788
786
}
789
787
790
- impl FromWithTcx < clean:: Import > for Import {
788
+ impl FromWithTcx < clean:: Import > for Use {
791
789
fn from_tcx ( import : clean:: Import , tcx : TyCtxt < ' _ > ) -> Self {
792
790
use clean:: ImportKind :: * ;
793
- let ( name, glob ) = match import. kind {
791
+ let ( name, is_glob ) = match import. kind {
794
792
Simple ( s) => ( s. to_string ( ) , false ) ,
795
793
Glob => (
796
794
import. source . path . last_opt ( ) . unwrap_or_else ( || Symbol :: intern ( "*" ) ) . to_string ( ) ,
797
795
true ,
798
796
) ,
799
797
} ;
800
- Import {
798
+ Use {
801
799
source : import. source . path . whole_name ( ) ,
802
800
name,
803
801
id : import. source . did . map ( ItemId :: from) . map ( |i| id_from_item_default ( i, tcx) ) ,
804
- glob ,
802
+ is_glob ,
805
803
}
806
804
}
807
805
}
@@ -835,7 +833,7 @@ impl FromWithTcx<clean::Static> for Static {
835
833
fn from_tcx ( stat : clean:: Static , tcx : TyCtxt < ' _ > ) -> Self {
836
834
Static {
837
835
type_ : ( * stat. type_ ) . into_tcx ( tcx) ,
838
- mutable : stat. mutability == ast:: Mutability :: Mut ,
836
+ is_mutable : stat. mutability == ast:: Mutability :: Mut ,
839
837
expr : stat
840
838
. expr
841
839
. 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 {
856
854
match kind {
857
855
Module => ItemKind :: Module ,
858
856
ExternCrate => ItemKind :: ExternCrate ,
859
- Import => ItemKind :: Import ,
857
+ Import => ItemKind :: Use ,
860
858
Struct => ItemKind :: Struct ,
861
859
Union => ItemKind :: Union ,
862
860
Enum => ItemKind :: Enum ,
@@ -872,7 +870,7 @@ impl FromWithTcx<ItemType> for ItemKind {
872
870
Primitive => ItemKind :: Primitive ,
873
871
AssocConst => ItemKind :: AssocConst ,
874
872
AssocType => ItemKind :: AssocType ,
875
- ForeignType => ItemKind :: ForeignType ,
873
+ ForeignType => ItemKind :: ExternType ,
876
874
Keyword => ItemKind :: Keyword ,
877
875
TraitAlias => ItemKind :: TraitAlias ,
878
876
ProcAttribute => ItemKind :: ProcAttribute ,
0 commit comments