Skip to content

Commit a65c050

Browse files
committed
inline: Round word-size cost estimates up
1 parent 18ec4a9 commit a65c050

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compiler/rustc_mir/src/transform/inline.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ impl Inliner<'tcx> {
382382
// Cost of the var is the size in machine-words, if we know
383383
// it.
384384
if let Some(size) = type_size_of(tcx, self.param_env, ty) {
385-
cost += (size / ptr_size) as usize;
385+
cost += ((size + ptr_size - 1) / ptr_size) as usize;
386386
} else {
387387
cost += UNKNOWN_SIZE_COST;
388388
}

0 commit comments

Comments
 (0)