diff options
| author | Keegan McAllister <mcallister.keegan@gmail.com> | 2015-02-18 18:07:03 -0800 |
|---|---|---|
| committer | Keegan McAllister <mcallister.keegan@gmail.com> | 2015-02-18 18:07:03 -0800 |
| commit | 0c1fc1ca7b3b4c67e362e89e4cec33854d1e7de6 (patch) | |
| tree | 8c854f1a3a1eafa56b45e990864fbb100735a7aa | |
| parent | bb22c100db4b9f2c11aa0dbb78a5728087190dc6 (diff) | |
| download | rust-0c1fc1ca7b3b4c67e362e89e4cec33854d1e7de6.tar.gz rust-0c1fc1ca7b3b4c67e362e89e4cec33854d1e7de6.zip | |
borrowck/README.md: Clarify MUTABILITY and ALIASABLE
| -rw-r--r-- | src/librustc_borrowck/borrowck/README.md | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/librustc_borrowck/borrowck/README.md b/src/librustc_borrowck/borrowck/README.md index d8e4466d627..9eb1576e757 100644 --- a/src/librustc_borrowck/borrowck/README.md +++ b/src/librustc_borrowck/borrowck/README.md @@ -261,12 +261,11 @@ that will go into the final loan. We'll discuss in more detail below. ## Checking mutability Checking mutability is fairly straightforward. We just want to prevent -immutable data from being borrowed as mutable. Note that it is ok to -borrow mutable data as immutable, since that is simply a -freeze. Formally we define a predicate `MUTABLE(LV, MQ)` which, if -defined, means that "borrowing `LV` with mutability `MQ` is ok. The -Rust code corresponding to this predicate is the function -`check_mutability` in `middle::borrowck::gather_loans`. +immutable data from being borrowed as mutable. Note that it is ok to borrow +mutable data as immutable, since that is simply a freeze. The judgement +`MUTABILITY(LV, MQ)` means the mutability of `LV` is compatible with a borrow +of mutability `MQ`. The Rust code corresponding to this predicate is the +function `check_mutability` in `middle::borrowck::gather_loans`. ### Checking mutability of variables @@ -321,12 +320,11 @@ MUTABILITY(*LV, MQ) // M-Deref-Borrowed-Mut ## Checking aliasability -The goal of the aliasability check is to ensure that we never permit -`&mut` borrows of aliasable data. Formally we define a predicate -`ALIASABLE(LV, MQ)` which if defined means that -"borrowing `LV` with mutability `MQ` is ok". The -Rust code corresponding to this predicate is the function -`check_aliasability()` in `middle::borrowck::gather_loans`. +The goal of the aliasability check is to ensure that we never permit `&mut` +borrows of aliasable data. The judgement `ALIASABLE(LV, MQ)` means the +aliasability of `LV` is compatible with a borrow of mutability `MQ`. The Rust +code corresponding to this predicate is the function `check_aliasability()` in +`middle::borrowck::gather_loans`. ### Checking aliasability of variables |
