Skip to content

Commit b2c3a41

Browse files
incr.comp.: Properly incorporate symbol linkage and visibility into CGU hash.
1 parent 0b5c087 commit b2c3a41

File tree

2 files changed

+5
-18
lines changed

2 files changed

+5
-18
lines changed

src/librustc_trans/base.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1172,7 +1172,7 @@ pub fn trans_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
11721172

11731173
let cgu_name = String::from(cgu.name());
11741174
let cgu_id = cgu.work_product_id();
1175-
let symbol_name_hash = cgu.compute_symbol_name_hash(scx, &exported_symbols);
1175+
let symbol_name_hash = cgu.compute_symbol_name_hash(scx);
11761176

11771177
// Check whether there is a previous work-product we can
11781178
// re-use. Not only must the file exist, and the inputs not

src/librustc_trans/partitioning.rs

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -174,29 +174,16 @@ impl<'tcx> CodegenUnit<'tcx> {
174174
}
175175

176176
pub fn compute_symbol_name_hash<'a>(&self,
177-
scx: &SharedCrateContext<'a, 'tcx>,
178-
exported_symbols: &ExportedSymbols)
177+
scx: &SharedCrateContext<'a, 'tcx>)
179178
-> u64 {
180179
let mut state = IchHasher::new();
181-
let exported_symbols = exported_symbols.local_exports();
182180
let all_items = self.items_in_deterministic_order(scx.tcx());
183-
for (item, _) in all_items {
181+
for (item, (linkage, visibility)) in all_items {
184182
let symbol_name = item.symbol_name(scx.tcx());
185183
symbol_name.len().hash(&mut state);
186184
symbol_name.hash(&mut state);
187-
let exported = match item {
188-
TransItem::Fn(ref instance) => {
189-
let node_id =
190-
scx.tcx().hir.as_local_node_id(instance.def_id());
191-
node_id.map(|node_id| exported_symbols.contains(&node_id))
192-
.unwrap_or(false)
193-
}
194-
TransItem::Static(node_id) => {
195-
exported_symbols.contains(&node_id)
196-
}
197-
TransItem::GlobalAsm(..) => true,
198-
};
199-
exported.hash(&mut state);
185+
linkage.hash(&mut state);
186+
visibility.hash(&mut state);
200187
}
201188
state.finish().to_smaller_hash()
202189
}

0 commit comments

Comments
 (0)