Skip to content

Commit 6ff7c8f

Browse files
committed
more documentation
1 parent 6641415 commit 6ff7c8f

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/librustc/mir/mod.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -825,7 +825,9 @@ pub enum StatementKind<'tcx> {
825825
inputs: Vec<Operand<'tcx>>
826826
},
827827

828-
/// Assert the given lvalues to be valid inhabitants of their type.
828+
/// Assert the given lvalues to be valid inhabitants of their type. These statements are
829+
/// currently only interpreted by miri and only generated when "-Z mir-emit-validate" is passed.
830+
/// See <https://internals.rust-lang.org/t/types-as-contracts/5562/73> for more details.
829831
Validate(ValidationOp, Vec<ValidationOperand<'tcx, Lvalue<'tcx>>>),
830832

831833
/// Mark one terminating point of an extent (i.e. static region).
@@ -836,10 +838,19 @@ pub enum StatementKind<'tcx> {
836838
Nop,
837839
}
838840

841+
/// The `ValidationOp` describes what happens with each of the operands of a
842+
/// `Validate` statement.
839843
#[derive(Copy, Clone, RustcEncodable, RustcDecodable, PartialEq, Eq)]
840844
pub enum ValidationOp {
845+
/// Recursively traverse the lvalue following the type and validate that all type
846+
/// invariants are maintained. Furthermore, acquire exclusive/read-only access to the
847+
/// memory reachable from the lvalue.
841848
Acquire,
849+
/// Recursive traverse the *mutable* part of the type and relinquish all exclusive
850+
/// access.
842851
Release,
852+
/// Recursive traverse the *mutable* part of the type and relinquish all exclusive
853+
/// access *until* the given region ends. Then, access will be recovered.
843854
Suspend(CodeExtent),
844855
}
845856

0 commit comments

Comments
 (0)