Add par_body_owners
This commit is contained in:
parent
5230979794
commit
6ee8e0fc11
@ -44,7 +44,7 @@ use std::cmp::{self, Ordering};
|
||||
use std::fmt;
|
||||
use std::hash::{Hash, Hasher};
|
||||
use std::ops::Deref;
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
use rustc_data_structures::sync::{self, Lrc, ParallelIterator, par_iter};
|
||||
use std::slice;
|
||||
use std::vec::IntoIter;
|
||||
use std::mem;
|
||||
@ -2436,6 +2436,12 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
|
||||
.map(move |&body_id| self.hir.body_owner_def_id(body_id))
|
||||
}
|
||||
|
||||
pub fn par_body_owners<F: Fn(DefId) + sync::Sync + sync::Send>(self, f: F) {
|
||||
par_iter(&self.hir.krate().body_ids).for_each(|&body_id| {
|
||||
f(self.hir.body_owner_def_id(body_id))
|
||||
});
|
||||
}
|
||||
|
||||
pub fn expr_span(self, id: NodeId) -> Span {
|
||||
match self.hir.find(id) {
|
||||
Some(hir_map::NodeExpr(e)) => {
|
||||
|
Loading…
Reference in New Issue
Block a user