@@ -16,13 +16,13 @@ crate const COLLECT_TRAIT_IMPLS: Pass = Pass {
1616
1717crate fn collect_trait_impls ( krate : Crate , cx : & DocContext < ' _ > ) -> Crate {
1818 let mut synth = SyntheticImplCollector :: new ( cx) ;
19- let mut krate = synth. fold_crate ( krate) ;
19+ let mut krate = cx . sess ( ) . time ( "collect_synthetic_impls" , || synth. fold_crate ( krate) ) ;
2020
2121 let prims: FxHashSet < PrimitiveType > = krate. primitives . iter ( ) . map ( |p| p. 1 ) . collect ( ) ;
2222
2323 let crate_items = {
2424 let mut coll = ItemCollector :: new ( ) ;
25- krate = coll. fold_crate ( krate) ;
25+ krate = cx . sess ( ) . time ( "collect_items_for_trait_impls" , || coll. fold_crate ( krate) ) ;
2626 coll. items
2727 } ;
2828
@@ -39,16 +39,18 @@ crate fn collect_trait_impls(krate: Crate, cx: &DocContext<'_>) -> Crate {
3939 // Also try to inline primitive impls from other crates.
4040 for & def_id in PrimitiveType :: all_impls ( cx. tcx ) . values ( ) . flatten ( ) {
4141 if !def_id. is_local ( ) {
42- inline:: build_impl ( cx, None , def_id, None , & mut new_items) ;
42+ cx. sess ( ) . time ( "build_primitive_trait_impl" , || {
43+ inline:: build_impl ( cx, None , def_id, None , & mut new_items) ;
4344
44- // FIXME(eddyb) is this `doc(hidden)` check needed?
45- if !cx. tcx . get_attrs ( def_id) . lists ( sym:: doc) . has_word ( sym:: hidden) {
46- let self_ty = cx. tcx . type_of ( def_id) ;
47- let impls = get_auto_trait_and_blanket_impls ( cx, self_ty, def_id) ;
48- let mut renderinfo = cx. renderinfo . borrow_mut ( ) ;
45+ // FIXME(eddyb) is this `doc(hidden)` check needed?
46+ if !cx. tcx . get_attrs ( def_id) . lists ( sym:: doc) . has_word ( sym:: hidden) {
47+ let self_ty = cx. tcx . type_of ( def_id) ;
48+ let impls = get_auto_trait_and_blanket_impls ( cx, self_ty, def_id) ;
49+ let mut renderinfo = cx. renderinfo . borrow_mut ( ) ;
4950
50- new_items. extend ( impls. filter ( |i| renderinfo. inlined . insert ( i. def_id ) ) ) ;
51- }
51+ new_items. extend ( impls. filter ( |i| renderinfo. inlined . insert ( i. def_id ) ) ) ;
52+ }
53+ } )
5254 }
5355 }
5456
@@ -151,11 +153,13 @@ impl<'a, 'tcx> DocFolder for SyntheticImplCollector<'a, 'tcx> {
151153 if i. is_struct ( ) || i. is_enum ( ) || i. is_union ( ) {
152154 // FIXME(eddyb) is this `doc(hidden)` check needed?
153155 if !self . cx . tcx . get_attrs ( i. def_id ) . lists ( sym:: doc) . has_word ( sym:: hidden) {
154- self . impls . extend ( get_auto_trait_and_blanket_impls (
155- self . cx ,
156- self . cx . tcx . type_of ( i. def_id ) ,
157- i. def_id ,
158- ) ) ;
156+ self . cx . sess ( ) . time ( "get_auto_trait_and_blanket_synthetic_impls" , || {
157+ self . impls . extend ( get_auto_trait_and_blanket_impls (
158+ self . cx ,
159+ self . cx . tcx . type_of ( i. def_id ) ,
160+ i. def_id ,
161+ ) ) ;
162+ } ) ;
159163 }
160164 }
161165
0 commit comments