From 8bfe82bfad881c580b02fe61b699a770790e18e2 Mon Sep 17 00:00:00 2001 From: Dylan MacKenzie Date: Wed, 25 Sep 2019 13:25:06 -0700 Subject: [PATCH] Correct `IndirectlyMutableLocals` docs --- src/librustc_mir/dataflow/impls/indirect_mutation.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/librustc_mir/dataflow/impls/indirect_mutation.rs b/src/librustc_mir/dataflow/impls/indirect_mutation.rs index 353892820e3f..7d20248ebd1f 100644 --- a/src/librustc_mir/dataflow/impls/indirect_mutation.rs +++ b/src/librustc_mir/dataflow/impls/indirect_mutation.rs @@ -8,15 +8,11 @@ use crate::dataflow::{self, GenKillSet}; /// Whether a borrow to a `Local` has been created that could allow that `Local` to be mutated /// indirectly. This could either be a mutable reference (`&mut`) or a shared borrow if the type of -/// that `Local` allows interior mutability. +/// that `Local` allows interior mutability. Operations that can mutate local's indirectly include: +/// assignments through a pointer (`*p = 42`), function calls, drop terminators and inline assembly. /// -/// If this returns false for a `Local` at the location of an indirect assignment, that `Local` -/// cannot be mutated by that assignment. For example, if the dataflow state at a statement like -/// `*p = 42` contained locals `x` and `z` but not `y`, we know that while `x` or `z` may be the -/// target of that assignment, `y` cannot be. -/// -/// Assignments through a pointer are not the only place where a `Local` can be mutated indirectly: -/// Function calls, drop terminators and inline assembly can all mutate `Local`s as a side-effect. +/// If this returns false for a `Local` at a given statement (or terminator), that `Local` could +/// not possibly have been mutated indirectly prior to that statement. #[derive(Copy, Clone)] pub struct IndirectlyMutableLocals<'mir, 'tcx> { body: &'mir mir::Body<'tcx>,