about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src/mir
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2020-11-09 19:07:02 +0100
committerGitHub <noreply@github.com>2020-11-09 19:07:02 +0100
commitc150b933ac73a7a1102f1ee934e8f94bfe73be63 (patch)
tree3c062e157444df6991fc582cf36b48a8d83b7e2a /compiler/rustc_codegen_ssa/src/mir
parent7924ecc341d5e7dcdaff22bfd16e76da136c9112 (diff)
parentf78f36cdb79db07ae2b650426fd42c94a2f29ae9 (diff)
downloadrust-c150b933ac73a7a1102f1ee934e8f94bfe73be63.tar.gz
rust-c150b933ac73a7a1102f1ee934e8f94bfe73be63.zip
Rollup merge of #78844 - tmiasko:monomorphize-sizeof, r=oli-obk
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.
Diffstat (limited to 'compiler/rustc_codegen_ssa/src/mir')
-rw-r--r--compiler/rustc_codegen_ssa/src/mir/rvalue.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_ssa/src/mir/rvalue.rs b/compiler/rustc_codegen_ssa/src/mir/rvalue.rs
index 7ce110dcbfc..40ae0a13c72 100644
--- a/compiler/rustc_codegen_ssa/src/mir/rvalue.rs
+++ b/compiler/rustc_codegen_ssa/src/mir/rvalue.rs
@@ -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();