Skip to content

Commit 8bfe82b

Browse files
Correct IndirectlyMutableLocals docs
1 parent a302055 commit 8bfe82b

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/librustc_mir/dataflow/impls/indirect_mutation.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,11 @@ use crate::dataflow::{self, GenKillSet};
88

99
/// Whether a borrow to a `Local` has been created that could allow that `Local` to be mutated
1010
/// indirectly. This could either be a mutable reference (`&mut`) or a shared borrow if the type of
11-
/// that `Local` allows interior mutability.
11+
/// that `Local` allows interior mutability. Operations that can mutate local's indirectly include:
12+
/// assignments through a pointer (`*p = 42`), function calls, drop terminators and inline assembly.
1213
///
13-
/// If this returns false for a `Local` at the location of an indirect assignment, that `Local`
14-
/// cannot be mutated by that assignment. For example, if the dataflow state at a statement like
15-
/// `*p = 42` contained locals `x` and `z` but not `y`, we know that while `x` or `z` may be the
16-
/// target of that assignment, `y` cannot be.
17-
///
18-
/// Assignments through a pointer are not the only place where a `Local` can be mutated indirectly:
19-
/// Function calls, drop terminators and inline assembly can all mutate `Local`s as a side-effect.
14+
/// If this returns false for a `Local` at a given statement (or terminator), that `Local` could
15+
/// not possibly have been mutated indirectly prior to that statement.
2016
#[derive(Copy, Clone)]
2117
pub struct IndirectlyMutableLocals<'mir, 'tcx> {
2218
body: &'mir mir::Body<'tcx>,

0 commit comments

Comments
 (0)