Skip to content

Commit 6ee8e0f

Browse files
committed
Add par_body_owners
1 parent 5230979 commit 6ee8e0f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/librustc/ty/mod.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ use std::cmp::{self, Ordering};
4444
use std::fmt;
4545
use std::hash::{Hash, Hasher};
4646
use std::ops::Deref;
47-
use rustc_data_structures::sync::Lrc;
47+
use rustc_data_structures::sync::{self, Lrc, ParallelIterator, par_iter};
4848
use std::slice;
4949
use std::vec::IntoIter;
5050
use std::mem;
@@ -2436,6 +2436,12 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
24362436
.map(move |&body_id| self.hir.body_owner_def_id(body_id))
24372437
}
24382438

2439+
pub fn par_body_owners<F: Fn(DefId) + sync::Sync + sync::Send>(self, f: F) {
2440+
par_iter(&self.hir.krate().body_ids).for_each(|&body_id| {
2441+
f(self.hir.body_owner_def_id(body_id))
2442+
});
2443+
}
2444+
24392445
pub fn expr_span(self, id: NodeId) -> Span {
24402446
match self.hir.find(id) {
24412447
Some(hir_map::NodeExpr(e)) => {

0 commit comments

Comments
 (0)