Expand description
This module implements a points-to analysis for mutable references.
We use the result of the analysis to insert ghost statements at the points where pointers (ptr(l))
have to be converted to borrows (&mut T). For example, consider the function
โ
fn foo(mut x: i32, mut y: i32, b: bool) {
let r;
if b {
r = &mut x
} else {
r = &mut y
}
}In the then branch (resp. else) we know r must point to x (resp. y). Thus, during refinement
type checking, we give r types ptr(x) and ptr(y) in each branch respectively. However, at the
join point, r could point to either x or y so we must find a type that joins the two pointers.
We use the result of the analysis to insert a ghost statement at the end of each branch to convert
the pointer to a borrow &mut i32{v: ...} and use it as the join.
Structsยง
- Children ๐
- Collect
Pointer ๐ToBorrows - Map
- Partial mapping from
PlacetoPlaceIndex, where some places also have aValueIndex. - Place
Index ๐ - This index uniquely identifies a place.
- Place
Info ๐ - This is the information tracked for every
PlaceIndexand is stored byMap. - Points
ToAnalysis ๐ - This implement a points to analysis for mutable references over a [
FlatSet]. The analysis is a may analysis. If you want to know if a reference definitively points to a location you have to combine it with the result of a definitely initialized analysis. See module level documentation for more details. - State ๐
- The dataflow state for the
PointsToAnalysis. - Value
Index ๐ - This index uniquely identifies a tracked place and therefore a slot in
State.
Enumsยง
- Place
OrValue ๐ - Used as the result for r-value.
Functionsยง
- add_
ghost_ ๐statements - debug_
with_ ๐context - debug_
with_ ๐context_ rec - excluded_
locals ๐ - Returns all locals with projections that have their reference or address taken.