@@ -23,7 +23,7 @@ pub fn provide(providers: &mut Providers<'_>) {
2323fn inferred_outlives_of < ' a , ' tcx > (
2424 tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
2525 item_def_id : DefId ,
26- ) -> Lrc < Vec < ty:: Predicate < ' tcx > > > {
26+ ) -> & ' tcx [ ty:: Predicate < ' tcx > ] {
2727 let id = tcx
2828 . hir ( )
2929 . as_local_hir_id ( item_def_id)
@@ -37,8 +37,8 @@ fn inferred_outlives_of<'a, 'tcx>(
3737 let predicates = crate_map
3838 . predicates
3939 . get ( & item_def_id)
40- . unwrap_or ( & crate_map . empty_predicate )
41- . clone ( ) ;
40+ . map ( |p| * p )
41+ . unwrap_or ( & [ ] ) ;
4242
4343 if tcx. has_attr ( item_def_id, "rustc_outlives" ) {
4444 let mut pred: Vec < String > = predicates
@@ -63,10 +63,10 @@ fn inferred_outlives_of<'a, 'tcx>(
6363 predicates
6464 }
6565
66- _ => Lrc :: new ( Vec :: new ( ) ) ,
66+ _ => & [ ] ,
6767 } ,
6868
69- _ => Lrc :: new ( Vec :: new ( ) ) ,
69+ _ => & [ ] ,
7070 }
7171}
7272
@@ -96,7 +96,7 @@ fn inferred_outlives_crate<'tcx>(
9696 let predicates = global_inferred_outlives
9797 . iter ( )
9898 . map ( |( & def_id, set) | {
99- let vec : Vec < ty :: Predicate < ' tcx > > = set
99+ let predicates = tcx . arena . alloc_from_iter ( set
100100 . iter ( )
101101 . filter_map (
102102 |ty:: OutlivesPredicate ( kind1, region2) | match kind1. unpack ( ) {
@@ -115,14 +115,11 @@ fn inferred_outlives_crate<'tcx>(
115115 None
116116 }
117117 } ,
118- ) . collect ( ) ;
119- ( def_id, Lrc :: new ( vec ) )
118+ ) ) ;
119+ ( def_id, & * predicates )
120120 } ) . collect ( ) ;
121121
122- let empty_predicate = Lrc :: new ( Vec :: new ( ) ) ;
123-
124122 Lrc :: new ( ty:: CratePredicatesMap {
125123 predicates,
126- empty_predicate,
127124 } )
128125}
0 commit comments