@@ -16,13 +16,13 @@ crate const COLLECT_TRAIT_IMPLS: Pass = Pass {
16
16
17
17
crate fn collect_trait_impls ( krate : Crate , cx : & DocContext < ' _ > ) -> Crate {
18
18
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) ) ;
20
20
21
21
let prims: FxHashSet < PrimitiveType > = krate. primitives . iter ( ) . map ( |p| p. 1 ) . collect ( ) ;
22
22
23
23
let crate_items = {
24
24
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) ) ;
26
26
coll. items
27
27
} ;
28
28
@@ -39,16 +39,18 @@ crate fn collect_trait_impls(krate: Crate, cx: &DocContext<'_>) -> Crate {
39
39
// Also try to inline primitive impls from other crates.
40
40
for & def_id in PrimitiveType :: all_impls ( cx. tcx ) . values ( ) . flatten ( ) {
41
41
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) ;
43
44
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 ( ) ;
49
50
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
+ } )
52
54
}
53
55
}
54
56
@@ -151,11 +153,13 @@ impl<'a, 'tcx> DocFolder for SyntheticImplCollector<'a, 'tcx> {
151
153
if i. is_struct ( ) || i. is_enum ( ) || i. is_union ( ) {
152
154
// FIXME(eddyb) is this `doc(hidden)` check needed?
153
155
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
+ } ) ;
159
163
}
160
164
}
161
165
0 commit comments