@@ -258,7 +258,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
258258 let def_id = variant. did ;
259259
260260 let data = VariantData {
261- kind : variant. kind ,
261+ ctor_kind : variant. ctor_kind ,
262262 disr : variant. disr_val . to_u64_unchecked ( ) ,
263263 struct_ctor : None
264264 } ;
@@ -410,7 +410,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
410410 let variant = tcx. lookup_adt_def ( adt_def_id) . struct_variant ( ) ;
411411
412412 let data = VariantData {
413- kind : variant. kind ,
413+ ctor_kind : variant. ctor_kind ,
414414 disr : variant. disr_val . to_u64_unchecked ( ) ,
415415 struct_ctor : Some ( def_id. index )
416416 } ;
@@ -675,7 +675,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
675675 None
676676 } ;
677677 EntryKind :: Struct ( self . lazy ( & VariantData {
678- kind : variant. kind ,
678+ ctor_kind : variant. ctor_kind ,
679679 disr : variant. disr_val . to_u64_unchecked ( ) ,
680680 struct_ctor : struct_ctor
681681 } ) )
@@ -684,7 +684,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
684684 let variant = tcx. lookup_adt_def ( def_id) . struct_variant ( ) ;
685685
686686 EntryKind :: Union ( self . lazy ( & VariantData {
687- kind : variant. kind ,
687+ ctor_kind : variant. ctor_kind ,
688688 disr : variant. disr_val . to_u64_unchecked ( ) ,
689689 struct_ctor : None
690690 } ) )
@@ -889,19 +889,12 @@ impl<'a, 'b, 'tcx> IndexBuilder<'a, 'b, 'tcx> {
889889 hir:: ItemStruct ( ref struct_def, _) => {
890890 self . encode_fields ( def_id) ;
891891
892- // If this is a tuple-like struct, encode the type of the constructor.
893- match self . tcx . lookup_adt_def ( def_id) . struct_variant ( ) . kind {
894- ty:: VariantKind :: Struct => {
895- // no value for structs like struct Foo { ... }
896- }
897- ty:: VariantKind :: Tuple | ty:: VariantKind :: Unit => {
898- // there is a value for structs like `struct
899- // Foo()` and `struct Foo`
900- let ctor_def_id = self . tcx . map . local_def_id ( struct_def. id ( ) ) ;
901- self . record ( ctor_def_id,
902- EncodeContext :: encode_struct_ctor,
903- ( def_id, ctor_def_id) ) ;
904- }
892+ // If the struct has a constructor, encode it.
893+ if !struct_def. is_struct ( ) {
894+ let ctor_def_id = self . tcx . map . local_def_id ( struct_def. id ( ) ) ;
895+ self . record ( ctor_def_id,
896+ EncodeContext :: encode_struct_ctor,
897+ ( def_id, ctor_def_id) ) ;
905898 }
906899 }
907900 hir:: ItemUnion ( ..) => {
0 commit comments