From 4cbe13adabc172f2f4bc40ca7590804d1378a22d Mon Sep 17 00:00:00 2001 From: Jakob Degen Date: Tue, 5 Apr 2022 17:22:31 -0400 Subject: [PATCH] Document semantics of `Deinit` and `SetDiscriminant` MIR statements --- compiler/rustc_middle/src/mir/mod.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/compiler/rustc_middle/src/mir/mod.rs b/compiler/rustc_middle/src/mir/mod.rs index 3832025f0385..578fcd82ad61 100644 --- a/compiler/rustc_middle/src/mir/mod.rs +++ b/compiler/rustc_middle/src/mir/mod.rs @@ -1588,8 +1588,15 @@ pub enum StatementKind<'tcx> { FakeRead(Box<(FakeReadCause, Place<'tcx>)>), /// Write the discriminant for a variant to the enum Place. + /// + /// This is permitted for both generators and ADTs. This does not necessarily write to the + /// entire place; instead, it writes to the minimum set of bytes as required by the layout for + /// the type. SetDiscriminant { place: Box>, variant_index: VariantIdx }, + /// Deinitializes the place. + /// + /// This writes `uninit` bytes to the entire place. Deinit(Box>), /// Start a live range for the storage of the local.