Skip to content

Commit c380fba

Browse files
author
Keegan McAllister
committed
---
yaml --- r: 187134 b: refs/heads/try c: 160cf96 h: refs/heads/master v: v3
1 parent 1f92f0c commit c380fba

File tree

3 files changed

+2
-38
lines changed

3 files changed

+2
-38
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: b4c965ee803a4521d8b4575f634e036f93e408f3
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 3a96d6a9818fe2affc98a187fb1065120458cee9
5-
refs/heads/try: 0c1fc1ca7b3b4c67e362e89e4cec33854d1e7de6
5+
refs/heads/try: 160cf962e7efaca024202421e58a5c83f0d1cbe8
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
88
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try/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

branches/try/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)