Misc (To Update)
Unpacking Places
An unpack operation introduces an Unpack
edge into the graph, and is associated with a source place and an expansion . An unpack operation can either be mutable or read-only.
An unpack operation is a dereference unpack for lifetime iff the type of the source place p is &'r mut p
or &'r p
.
Applying an unpack operation introduces an Unpack
edge as follows:
- If the unpack operation is a dereference operation, the edge is added to the graph.
- Otherwise, the edge is added to the graph.
A mutable unpack operation for capabiliy requires that the source place have capability . When the operation is a applied, the capability for is removed and the capability of all places in is set to .
A read-only unpack operation requires that have capability and assigns capability to all places in .
Updating Lifetime Projections
Assume the source place has type with lifetimes . If the unpack operation is mutable, then we label each lifetime projection with location .
The source lifetime projection for a lifetime is if the unpack is mutable, and otherwise. The target lifetime projections is the set .
For each lifetime , if the set of target lifetime projections associated with is nonempty:
- For each in the set of target projections, add a
BorrowFlow
edge where is the source projection1.
- If the unpack is mutable and the source place of the expansion is either a reference or a borrowed place:
a. Add a
Future
edge b. For each in the set of target projections, add aFuture
edge c. If anyFuture
edges originate from the source projection , redirect them such that they originate from .
Origin Containg Loan
An origin contains a loan created at location iff:
Polonius: Read directly from output facts
NLL: is live at and outlives
-
TODO: Currently we actually introduce an unpack edge in the implementation, but we should change this. ↩