@@ -269,12 +269,6 @@ impl<'a, 'b: 'a, 'tcx: 'b> EntryBuilder<'a, 'b, 'tcx> {
269269 let data = VariantData {
270270 ctor_kind : variant. ctor_kind ,
271271 discr : variant. discr ,
272- evaluated_discr : match variant. discr {
273- ty:: VariantDiscr :: Explicit ( def_id) => {
274- ty:: queries:: monomorphic_const_eval:: get ( tcx, DUMMY_SP , def_id) . ok ( )
275- }
276- ty:: VariantDiscr :: Relative ( _) => None
277- } ,
278272 struct_ctor : None ,
279273 } ;
280274
@@ -408,7 +402,6 @@ impl<'a, 'b: 'a, 'tcx: 'b> EntryBuilder<'a, 'b, 'tcx> {
408402 let data = VariantData {
409403 ctor_kind : variant. ctor_kind ,
410404 discr : variant. discr ,
411- evaluated_discr : None ,
412405 struct_ctor : Some ( def_id. index ) ,
413406 } ;
414407
@@ -697,7 +690,6 @@ impl<'a, 'b: 'a, 'tcx: 'b> EntryBuilder<'a, 'b, 'tcx> {
697690 EntryKind :: Struct ( self . lazy ( & VariantData {
698691 ctor_kind : variant. ctor_kind ,
699692 discr : variant. discr ,
700- evaluated_discr : None ,
701693 struct_ctor : struct_ctor,
702694 } ) , repr_options)
703695 }
@@ -708,7 +700,6 @@ impl<'a, 'b: 'a, 'tcx: 'b> EntryBuilder<'a, 'b, 'tcx> {
708700 EntryKind :: Union ( self . lazy ( & VariantData {
709701 ctor_kind : variant. ctor_kind ,
710702 discr : variant. discr ,
711- evaluated_discr : None ,
712703 struct_ctor : None ,
713704 } ) , repr_options)
714705 }
@@ -1037,6 +1028,17 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for EncodeVisitor<'a, 'b, 'tcx> {
10371028 EntryBuilder :: encode_info_for_foreign_item,
10381029 ( def_id, ni) ) ;
10391030 }
1031+ fn visit_variant ( & mut self ,
1032+ v : & ' tcx hir:: Variant ,
1033+ g : & ' tcx hir:: Generics ,
1034+ id : ast:: NodeId ) {
1035+ intravisit:: walk_variant ( self , v, g, id) ;
1036+
1037+ if let Some ( discr) = v. node . disr_expr {
1038+ let def_id = self . index . tcx . hir . body_owner_def_id ( discr) ;
1039+ self . index . record ( def_id, EntryBuilder :: encode_info_for_embedded_const, def_id) ;
1040+ }
1041+ }
10401042 fn visit_generics ( & mut self , generics : & ' tcx hir:: Generics ) {
10411043 intravisit:: walk_generics ( self , generics) ;
10421044 self . index . encode_info_for_generics ( generics) ;
@@ -1160,6 +1162,32 @@ impl<'a, 'b: 'a, 'tcx: 'b> EntryBuilder<'a, 'b, 'tcx> {
11601162 }
11611163 }
11621164
1165+ fn encode_info_for_embedded_const ( & mut self , def_id : DefId ) -> Entry < ' tcx > {
1166+ debug ! ( "EntryBuilder::encode_info_for_embedded_const({:?})" , def_id) ;
1167+ let tcx = self . tcx ;
1168+ let id = tcx. hir . as_local_node_id ( def_id) . unwrap ( ) ;
1169+ let body = tcx. hir . body_owned_by ( id) ;
1170+
1171+ Entry {
1172+ kind : EntryKind :: Const ( ty:: queries:: mir_const_qualif:: get ( tcx, DUMMY_SP , def_id) ) ,
1173+ visibility : self . lazy ( & ty:: Visibility :: Public ) ,
1174+ span : self . lazy ( & tcx. def_span ( def_id) ) ,
1175+ attributes : LazySeq :: empty ( ) ,
1176+ children : LazySeq :: empty ( ) ,
1177+ stability : None ,
1178+ deprecation : None ,
1179+
1180+ ty : Some ( self . encode_item_type ( def_id) ) ,
1181+ inherent_impls : LazySeq :: empty ( ) ,
1182+ variances : LazySeq :: empty ( ) ,
1183+ generics : Some ( self . encode_generics ( def_id) ) ,
1184+ predicates : Some ( self . encode_predicates ( def_id) ) ,
1185+
1186+ ast : Some ( self . encode_body ( body) ) ,
1187+ mir : self . encode_mir ( def_id) ,
1188+ }
1189+ }
1190+
11631191 fn encode_attributes ( & mut self , attrs : & [ ast:: Attribute ] ) -> LazySeq < ast:: Attribute > {
11641192 // NOTE: This must use lazy_seq_from_slice(), not lazy_seq() because
11651193 // we really on the HashStable specialization for [Attribute]
0 commit comments