Skip to content

Commit 4cbe13a

Browse files
committed
Document semantics of Deinit and SetDiscriminant MIR statements
1 parent 9b6b1a6 commit 4cbe13a

File tree

1 file changed

+7
-0
lines changed
  • compiler/rustc_middle/src/mir

1 file changed

+7
-0
lines changed

compiler/rustc_middle/src/mir/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1588,8 +1588,15 @@ pub enum StatementKind<'tcx> {
15881588
FakeRead(Box<(FakeReadCause, Place<'tcx>)>),
15891589

15901590
/// Write the discriminant for a variant to the enum Place.
1591+
///
1592+
/// This is permitted for both generators and ADTs. This does not necessarily write to the
1593+
/// entire place; instead, it writes to the minimum set of bytes as required by the layout for
1594+
/// the type.
15911595
SetDiscriminant { place: Box<Place<'tcx>>, variant_index: VariantIdx },
15921596

1597+
/// Deinitializes the place.
1598+
///
1599+
/// This writes `uninit` bytes to the entire place.
15931600
Deinit(Box<Place<'tcx>>),
15941601

15951602
/// Start a live range for the storage of the local.

0 commit comments

Comments
 (0)