Skip to content

Commit 15f5307

Browse files
committed
collector: move ensure_sufficient_stack out of the loop
1 parent 72d7897 commit 15f5307

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

compiler/rustc_monomorphize/src/collector.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1433,7 +1433,7 @@ fn create_mono_items_for_default_impls<'tcx>(
14331433
}
14341434
}
14351435

1436-
/// Scans the CTFE alloc in order to find function calls, closures, and drop-glue.
1436+
/// Scans the CTFE alloc in order to find function pointers and statics that must be monomorphized.
14371437
fn collect_alloc<'tcx>(tcx: TyCtxt<'tcx>, alloc_id: AllocId, output: &mut MonoItems<'tcx>) {
14381438
match tcx.global_alloc(alloc_id) {
14391439
GlobalAlloc::Static(def_id) => {
@@ -1446,11 +1446,11 @@ fn collect_alloc<'tcx>(tcx: TyCtxt<'tcx>, alloc_id: AllocId, output: &mut MonoIt
14461446
}
14471447
GlobalAlloc::Memory(alloc) => {
14481448
trace!("collecting {:?} with {:#?}", alloc_id, alloc);
1449-
for &prov in alloc.inner().provenance().ptrs().values() {
1450-
rustc_data_structures::stack::ensure_sufficient_stack(|| {
1449+
rustc_data_structures::stack::ensure_sufficient_stack(move || {
1450+
for &prov in alloc.inner().provenance().ptrs().values() {
14511451
collect_alloc(tcx, prov.alloc_id(), output);
1452-
});
1453-
}
1452+
}
1453+
});
14541454
}
14551455
GlobalAlloc::Function(fn_instance) => {
14561456
if should_codegen_locally(tcx, &fn_instance) {

0 commit comments

Comments
 (0)