From 160cf962e7efaca024202421e58a5c83f0d1cbe8 Mon Sep 17 00:00:00 2001 From: Keegan McAllister Date: Wed, 18 Feb 2015 18:08:35 -0800 Subject: [PATCH] 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. --- src/librustc_borrowck/borrowck/README.md | 36 +------------------ .../borrowck/gather_loans/lifetime.rs | 2 -- 2 files changed, 1 insertion(+), 37 deletions(-) diff --git a/src/librustc_borrowck/borrowck/README.md b/src/librustc_borrowck/borrowck/README.md index 9eb1576e7577..619301f17dd3 100644 --- a/src/librustc_borrowck/borrowck/README.md +++ b/src/librustc_borrowck/borrowck/README.md @@ -375,40 +375,6 @@ Formally, we define a predicate `LIFETIME(LV, LT, MQ)`, which states that `MQ`". The Rust code corresponding to this predicate is the module `middle::borrowck::gather_loans::lifetime`. -### The Scope function - -Several of the rules refer to a helper function `SCOPE(LV)=LT`. The -`SCOPE(LV)` yields the lifetime `LT` for which the lvalue `LV` is -guaranteed to exist, presuming that no mutations occur. - -The scope of a local variable is the block where it is declared: - -```text - SCOPE(X) = block where X is declared -``` - -The scope of a field is the scope of the struct: - -```text - SCOPE(LV.f) = SCOPE(LV) -``` - -The scope of a unique referent is the scope of the pointer, since -(barring mutation or moves) the pointer will not be freed until -the pointer itself `LV` goes out of scope: - -```text - SCOPE(*LV) = SCOPE(LV) if LV has type Box -``` - -The scope of a borrowed referent is the scope associated with the -pointer. This is a conservative approximation, since the data that -the pointer points at may actually live longer: - -```text - SCOPE(*LV) = LT if LV has type &'LT T or &'LT mut T -``` - ### Checking lifetime of variables The rule for variables states that a variable can only be borrowed a @@ -416,7 +382,7 @@ lifetime `LT` that is a subregion of the variable's scope: ```text LIFETIME(X, LT, MQ) // L-Local - LT <= SCOPE(X) + LT <= block where X is declared ``` ### Checking lifetime for owned content diff --git a/src/librustc_borrowck/borrowck/gather_loans/lifetime.rs b/src/librustc_borrowck/borrowck/gather_loans/lifetime.rs index 1c57097ae263..9f7b4cf26e1c 100644 --- a/src/librustc_borrowck/borrowck/gather_loans/lifetime.rs +++ b/src/librustc_borrowck/borrowck/gather_loans/lifetime.rs @@ -106,8 +106,6 @@ impl<'a, 'tcx> GuaranteeLifetimeContext<'a, 'tcx> { //! lvalue `cmt` is guaranteed to be valid without any //! rooting etc, and presuming `cmt` is not mutated. - // See the SCOPE(LV) function in doc.rs - match cmt.cat { mc::cat_rvalue(temp_scope) => { temp_scope