Skip to content

Commit e2ecb68

Browse files
committed
use par_for_each_in in par_body_owners and collect_crate_mono_items
1 parent 96c2df8 commit e2ecb68

File tree

6 files changed

+28
-9
lines changed

6 files changed

+28
-9
lines changed

compiler/rustc_data_structures/src/sync.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ cfg_if! {
146146
t.into_iter()
147147
}
148148

149-
pub fn par_for_each_in<T: IntoIterator>(t: T, for_each: impl Fn(T::Item) + Sync + Send) {
149+
pub fn par_for_each_in<T: IntoIterator>(t: T, mut for_each: impl FnMut(T::Item) + Sync + Send) {
150150
// We catch panics here ensuring that all the loop iterations execute.
151151
// This makes behavior consistent with the parallel compiler.
152152
let mut panic = None;

compiler/rustc_middle/src/hir/map/mod.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -491,9 +491,7 @@ impl<'hir> Map<'hir> {
491491
}
492492

493493
pub fn par_body_owners<F: Fn(LocalDefId) + Sync + Send>(self, f: F) {
494-
use rustc_data_structures::sync::{par_iter, ParallelIterator};
495-
496-
par_iter(&self.tcx.hir_crate_items(()).body_owners[..]).for_each(|&def_id| f(def_id));
494+
par_for_each_in(&self.tcx.hir_crate_items(()).body_owners[..], |&def_id| f(def_id));
497495
}
498496

499497
pub fn ty_param_owner(self, def_id: LocalDefId) -> LocalDefId {

compiler/rustc_monomorphize/src/collector.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@
180180
//! regardless of whether it is actually needed or not.
181181
182182
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
183-
use rustc_data_structures::sync::{par_iter, MTLock, MTRef, ParallelIterator};
183+
use rustc_data_structures::sync::{par_for_each_in, MTLock, MTRef};
184184
use rustc_hir as hir;
185185
use rustc_hir::def::DefKind;
186186
use rustc_hir::def_id::{DefId, DefIdMap, LocalDefId};
@@ -346,7 +346,7 @@ pub fn collect_crate_mono_items(
346346
let inlining_map: MTRef<'_, _> = &mut inlining_map;
347347

348348
tcx.sess.time("monomorphization_collector_graph_walk", || {
349-
par_iter(roots).for_each(|root| {
349+
par_for_each_in(roots, |root| {
350350
let mut recursion_depths = DefIdMap::default();
351351
collect_items_rec(
352352
tcx,

src/test/ui/privacy/privacy2.stderr

+7-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,13 @@ LL | pub fn foo() {}
2323

2424
error: requires `sized` lang_item
2525

26-
error: aborting due to 3 previous errors
26+
error: requires `sized` lang_item
27+
28+
error: requires `sized` lang_item
29+
30+
error: requires `sized` lang_item
31+
32+
error: aborting due to 6 previous errors
2733

2834
Some errors have detailed explanations: E0432, E0603.
2935
For more information about an error, try `rustc --explain E0432`.

src/test/ui/privacy/privacy3.stderr

+7-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ LL | use bar::gpriv;
66

77
error: requires `sized` lang_item
88

9-
error: aborting due to 2 previous errors
9+
error: requires `sized` lang_item
10+
11+
error: requires `sized` lang_item
12+
13+
error: requires `sized` lang_item
14+
15+
error: aborting due to 5 previous errors
1016

1117
For more information about this error, try `rustc --explain E0432`.

src/test/ui/type_length_limit.stderr

+10-1
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,14 @@ LL | pub fn drop<T>(_x: T) {}
77
= note: the full type name has been written to '$TEST_BUILD_DIR/type_length_limit/type_length_limit.long-type.txt'
88
= help: consider adding a `#![type_length_limit="8"]` attribute to your crate
99

10-
error: aborting due to previous error
10+
error: reached the type-length limit while instantiating `<[closure@std::rt::lang_start<()...e<()>>::call_once - shim(vtable)`
11+
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
12+
|
13+
LL | extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
14+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
15+
|
16+
= note: the full type name has been written to '$TEST_BUILD_DIR/type_length_limit/type_length_limit.long-type.txt'
17+
= help: consider adding a `#![type_length_limit="8"]` attribute to your crate
18+
19+
error: aborting due to 2 previous errors
1120

0 commit comments

Comments
 (0)