@@ -10,6 +10,7 @@ use crate::ty::query::Providers;
10
10
use crate :: ty:: { DefIdTree , ImplSubject , TyCtxt } ;
11
11
use rustc_data_structures:: fingerprint:: Fingerprint ;
12
12
use rustc_data_structures:: stable_hasher:: { HashStable , StableHasher } ;
13
+ use rustc_data_structures:: sync:: { par_for_each_in, Send , Sync } ;
13
14
use rustc_hir:: def_id:: { DefId , LocalDefId } ;
14
15
use rustc_hir:: * ;
15
16
use rustc_query_system:: ich:: StableHashingContext ;
@@ -61,6 +62,22 @@ impl ModuleItems {
61
62
pub fn foreign_items ( & self ) -> impl Iterator < Item = ForeignItemId > + ' _ {
62
63
self . foreign_items . iter ( ) . copied ( )
63
64
}
65
+
66
+ pub fn par_items ( & self , f : impl Fn ( ItemId ) + Send + Sync ) {
67
+ par_for_each_in ( & self . items [ ..] , |& id| f ( id) )
68
+ }
69
+
70
+ pub fn par_trait_items ( & self , f : impl Fn ( TraitItemId ) + Send + Sync ) {
71
+ par_for_each_in ( & self . trait_items [ ..] , |& id| f ( id) )
72
+ }
73
+
74
+ pub fn par_impl_items ( & self , f : impl Fn ( ImplItemId ) + Send + Sync ) {
75
+ par_for_each_in ( & self . impl_items [ ..] , |& id| f ( id) )
76
+ }
77
+
78
+ pub fn par_foreign_items ( & self , f : impl Fn ( ForeignItemId ) + Send + Sync ) {
79
+ par_for_each_in ( & self . foreign_items [ ..] , |& id| f ( id) )
80
+ }
64
81
}
65
82
66
83
impl < ' tcx > TyCtxt < ' tcx > {
0 commit comments