File tree Expand file tree Collapse file tree 3 files changed +8
-3
lines changed Expand file tree Collapse file tree 3 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -671,7 +671,9 @@ impl<'a, 'tcx> CrateMetadata {
671671 item_id : DefIndex ,
672672 tcx : TyCtxt < ' tcx > ,
673673 ) -> & ' tcx [ ( ty:: Predicate < ' tcx > , Span ) ] {
674- self . root . per_def . inferred_outlives . get ( self , item_id) . unwrap ( ) . decode ( ( self , tcx) )
674+ self . root . per_def . inferred_outlives . get ( self , item_id) . map ( |predicates| {
675+ predicates. decode ( ( self , tcx) )
676+ } ) . unwrap_or_default ( )
675677 }
676678
677679 crate fn get_super_predicates (
Original file line number Diff line number Diff line change @@ -842,8 +842,10 @@ impl EncodeContext<'tcx> {
842842
843843 fn encode_inferred_outlives ( & mut self , def_id : DefId ) {
844844 debug ! ( "EncodeContext::encode_inferred_outlives({:?})" , def_id) ;
845- record ! ( self . per_def. inferred_outlives[ def_id] <-
846- self . tcx. inferred_outlives_of( def_id) ) ;
845+ let inferred_outlives = self . tcx . inferred_outlives_of ( def_id) ;
846+ if !inferred_outlives. is_empty ( ) {
847+ record ! ( self . per_def. inferred_outlives[ def_id] <- inferred_outlives) ;
848+ }
847849 }
848850
849851 fn encode_super_predicates ( & mut self , def_id : DefId ) {
Original file line number Diff line number Diff line change @@ -249,6 +249,7 @@ crate struct LazyPerDefTables<'tcx> {
249249 // doesn't handle shorthands in its own (de)serialization impls,
250250 // as it's an `enum` for which we want to derive (de)serialization,
251251 // so the `ty::codec` APIs handle the whole `&'tcx [...]` at once.
252+ // Also, as an optimization, a missing entry indicates an empty `&[]`.
252253 pub inferred_outlives : Lazy ! ( PerDefTable <Lazy !( & ' tcx [ ( ty:: Predicate <' tcx>, Span ) ] ) >) ,
253254 pub super_predicates : Lazy ! ( PerDefTable <Lazy !( ty:: GenericPredicates <' tcx>) >) ,
254255
You can’t perform that action at this time.
0 commit comments