Skip to content

Commit 160cf96

Browse files
author
Keegan McAllister
committed
borrowck/README.md: Remove SCOPE (mostly unused)
Only one case is used in the text. All of them are pretty straightforward, so I don't think the code needs an explicit link to the README.
1 parent 0c1fc1c commit 160cf96

File tree

2 files changed

+1
-37
lines changed

2 files changed

+1
-37
lines changed

src/librustc_borrowck/borrowck/README.md

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -375,48 +375,14 @@ Formally, we define a predicate `LIFETIME(LV, LT, MQ)`, which states that
375375
`MQ`". The Rust code corresponding to this predicate is the module
376376
`middle::borrowck::gather_loans::lifetime`.
377377

378-
### The Scope function
379-
380-
Several of the rules refer to a helper function `SCOPE(LV)=LT`. The
381-
`SCOPE(LV)` yields the lifetime `LT` for which the lvalue `LV` is
382-
guaranteed to exist, presuming that no mutations occur.
383-
384-
The scope of a local variable is the block where it is declared:
385-
386-
```text
387-
SCOPE(X) = block where X is declared
388-
```
389-
390-
The scope of a field is the scope of the struct:
391-
392-
```text
393-
SCOPE(LV.f) = SCOPE(LV)
394-
```
395-
396-
The scope of a unique referent is the scope of the pointer, since
397-
(barring mutation or moves) the pointer will not be freed until
398-
the pointer itself `LV` goes out of scope:
399-
400-
```text
401-
SCOPE(*LV) = SCOPE(LV) if LV has type Box<T>
402-
```
403-
404-
The scope of a borrowed referent is the scope associated with the
405-
pointer. This is a conservative approximation, since the data that
406-
the pointer points at may actually live longer:
407-
408-
```text
409-
SCOPE(*LV) = LT if LV has type &'LT T or &'LT mut T
410-
```
411-
412378
### Checking lifetime of variables
413379

414380
The rule for variables states that a variable can only be borrowed a
415381
lifetime `LT` that is a subregion of the variable's scope:
416382

417383
```text
418384
LIFETIME(X, LT, MQ) // L-Local
419-
LT <= SCOPE(X)
385+
LT <= block where X is declared
420386
```
421387

422388
### Checking lifetime for owned content

src/librustc_borrowck/borrowck/gather_loans/lifetime.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,6 @@ impl<'a, 'tcx> GuaranteeLifetimeContext<'a, 'tcx> {
106106
//! lvalue `cmt` is guaranteed to be valid without any
107107
//! rooting etc, and presuming `cmt` is not mutated.
108108
109-
// See the SCOPE(LV) function in doc.rs
110-
111109
match cmt.cat {
112110
mc::cat_rvalue(temp_scope) => {
113111
temp_scope

0 commit comments

Comments
 (0)