about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2017-07-31 13:20:37 -0700
committerRalf Jung <post@ralfj.de>2017-07-31 13:20:37 -0700
commit6ff7c8fa047f98bfc6f1d7c9abdd64bc557add32 (patch)
tree59e45724da1928eab4b187c78889a455de24be5a /src
parent6641415e8744e3f82f464eba270296536b1edaa1 (diff)
downloadrust-6ff7c8fa047f98bfc6f1d7c9abdd64bc557add32.tar.gz
rust-6ff7c8fa047f98bfc6f1d7c9abdd64bc557add32.zip
more documentation
Diffstat (limited to 'src')
-rw-r--r--src/librustc/mir/mod.rs13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs
index 3ee86dbdc84..f7ef542544c 100644
--- a/src/librustc/mir/mod.rs
+++ b/src/librustc/mir/mod.rs
@@ -825,7 +825,9 @@ pub enum StatementKind<'tcx> {
         inputs: Vec<Operand<'tcx>>
     },
 
-    /// Assert the given lvalues to be valid inhabitants of their type.
+    /// Assert the given lvalues to be valid inhabitants of their type.  These statements are
+    /// currently only interpreted by miri and only generated when "-Z mir-emit-validate" is passed.
+    /// See <https://internals.rust-lang.org/t/types-as-contracts/5562/73> for more details.
     Validate(ValidationOp, Vec<ValidationOperand<'tcx, Lvalue<'tcx>>>),
 
     /// Mark one terminating point of an extent (i.e. static region).
@@ -836,10 +838,19 @@ pub enum StatementKind<'tcx> {
     Nop,
 }
 
+/// The `ValidationOp` describes what happens with each of the operands of a
+/// `Validate` statement.
 #[derive(Copy, Clone, RustcEncodable, RustcDecodable, PartialEq, Eq)]
 pub enum ValidationOp {
+    /// Recursively traverse the lvalue following the type and validate that all type
+    /// invariants are maintained.  Furthermore, acquire exclusive/read-only access to the
+    /// memory reachable from the lvalue.
     Acquire,
+    /// Recursive traverse the *mutable* part of the type and relinquish all exclusive
+    /// access.
     Release,
+    /// Recursive traverse the *mutable* part of the type and relinquish all exclusive
+    /// access *until* the given region ends.  Then, access will be recovered.
     Suspend(CodeExtent),
 }