Skip to content

Commit

Permalink
Rollup merge of #78844 - tmiasko:monomorphize-sizeof, r=oli-obk
Browse files Browse the repository at this point in the history
Monomorphize a type argument of size-of operation during codegen

This wasn't necessary until MIR inliner started to consider drop glue as
a candidate for inlining; introducing for the first time a generic use
of size-of operation.

No test at this point since this only happens with a custom inlining
threshold.
  • Loading branch information
Dylan-DPC committed Nov 9, 2020
2 parents 7924ecc + f78f36c commit c150b93
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions compiler/rustc_codegen_ssa/src/mir/rvalue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
}

mir::Rvalue::NullaryOp(mir::NullOp::SizeOf, ty) => {
let ty = self.monomorphize(&ty);
assert!(bx.cx().type_is_sized(ty));
let val = bx.cx().const_usize(bx.cx().layout_of(ty).size.bytes());
let tcx = self.cx.tcx();
Expand Down

0 comments on commit c150b93

Please sign in to comment.