Skip to content

Commit fe78b54

Browse files
committed
merge the "predeclare" and "declare" phases so we run them per-CGU
1 parent 3387505 commit fe78b54

File tree

1 file changed

+6
-20
lines changed

1 file changed

+6
-20
lines changed

src/librustc_trans/base.rs

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,43 +1142,29 @@ pub fn trans_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
11421142

11431143
assert_module_sources::assert_module_sources(tcx, &modules);
11441144

1145-
// Instantiate translation items without filling out definitions yet...
11461145
for ccx in crate_context_list.iter_need_trans() {
11471146
let dep_node = ccx.codegen_unit().work_product_dep_node();
11481147
tcx.dep_graph.with_task(dep_node,
11491148
ccx,
11501149
AssertDepGraphSafe(symbol_map.clone()),
11511150
trans_decl_task);
11521151

1152+
11531153
fn trans_decl_task<'a, 'tcx>(ccx: CrateContext<'a, 'tcx>,
11541154
symbol_map: AssertDepGraphSafe<Rc<SymbolMap<'tcx>>>) {
1155+
// Instantiate translation items without filling out definitions yet...
1156+
11551157
// FIXME(#40304): Instead of this, the symbol-map should be an
11561158
// on-demand thing that we compute.
11571159
let AssertDepGraphSafe(symbol_map) = symbol_map;
11581160
let cgu = ccx.codegen_unit();
11591161
let trans_items = cgu.items_in_deterministic_order(ccx.tcx(), &symbol_map);
1160-
for (trans_item, linkage) in trans_items {
1162+
for &(trans_item, linkage) in &trans_items {
11611163
trans_item.predefine(&ccx, linkage);
11621164
}
1163-
}
1164-
}
11651165

1166-
// ... and now that we have everything pre-defined, fill out those definitions.
1167-
for ccx in crate_context_list.iter_need_trans() {
1168-
let dep_node = ccx.codegen_unit().work_product_dep_node();
1169-
tcx.dep_graph.with_task(dep_node,
1170-
ccx,
1171-
AssertDepGraphSafe(symbol_map.clone()),
1172-
trans_def_task);
1173-
1174-
fn trans_def_task<'a, 'tcx>(ccx: CrateContext<'a, 'tcx>,
1175-
symbol_map: AssertDepGraphSafe<Rc<SymbolMap<'tcx>>>) {
1176-
// FIXME(#40304): Instead of this, the symbol-map should be an
1177-
// on-demand thing that we compute.
1178-
let AssertDepGraphSafe(symbol_map) = symbol_map;
1179-
let cgu = ccx.codegen_unit();
1180-
let trans_items = cgu.items_in_deterministic_order(ccx.tcx(), &symbol_map);
1181-
for (trans_item, _) in trans_items {
1166+
// ... and now that we have everything pre-defined, fill out those definitions.
1167+
for &(trans_item, _) in &trans_items {
11821168
trans_item.define(&ccx);
11831169
}
11841170

0 commit comments

Comments
 (0)