Also a little bit of clean up.
pub fn size_estimate(&self) -> usize {
// Should only be called if `estimate_size` has previously been called.
- assert!(self.size_estimate.is_some());
- self.size_estimate.unwrap()
+ self.size_estimate.expect("estimate_size must be called before getting a size_estimate")
}
pub fn modify_size_estimate(&mut self, delta: usize) {
let CodegenUnit {
ref items,
name,
- ..
+ // The size estimate is not relevant to the hash
+ size_estimate: _,
} = *self;
name.hash_stable(hcx, hasher);
instance_def: InstanceDef<'tcx>)
-> usize {
match instance_def {
- InstanceDef::Item(def_id) => {
- let mir = tcx.optimized_mir(def_id);
+ InstanceDef::Item(..) |
+ InstanceDef::DropGlue(..) => {
+ let mir = tcx.instance_mir(instance_def);
mir.basic_blocks().iter().map(|bb| bb.statements.len()).sum()
},
- // Estimate the size of compiler-generated shims to be 1.
+ // Estimate the size of other compiler-generated shims to be 1.
_ => 1
}
}