about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/value_and_place.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/value_and_place.rs b/src/value_and_place.rs
index 8ff35d2f76d..d82de1d3d8d 100644
--- a/src/value_and_place.rs
+++ b/src/value_and_place.rs
@@ -324,6 +324,12 @@ impl<'tcx> CPlace<'tcx> {
             };
         }
 
+        if layout.size.bytes() >= u64::from(u32::MAX - 16) {
+            fx.tcx
+                .sess
+                .fatal(&format!("values of type {} are too big to store on the stack", layout.ty));
+        }
+
         let stack_slot = fx.bcx.create_stack_slot(StackSlotData {
             kind: StackSlotKind::ExplicitSlot,
             // FIXME Don't force the size to a multiple of 16 bytes once Cranelift gets a way to