Find the points-to paths from the given node to the closure parameters (upvar). A points-to path is like [([], node), ([Field(0)], node1), ([Filed(1)], node2), ..., ([Field(n)], parameter)] Current points-to analysis does not support relations like `from _9.1 to _9`, which means pts(_9)⊇pts(_9.1) but not vice versa. The upvars in closures usually share the following pattern: _9 = &_1.1; // pts(_9
(
node: ConstraintNode<'tcx>,
body: &'tcx Body<'tcx>,
points_to_map: &PointsToMap<'tcx>,
)
| 1156 | |
| 1157 | fn projected_base_ty<'tcx>( |
| 1158 | local: Local, |
| 1159 | pts: &FxHashSet<ConstraintNode<'tcx>>, |
| 1160 | points_to_map: &PointsToMap<'tcx>, |
| 1161 | body: &Body<'tcx>, |
| 1162 | tcx: TyCtxt<'tcx>, |
| 1163 | ) -> Option<rustc_middle::ty::Ty<'tcx>> { |
| 1164 | if is_parameter(local, body) { |
| 1165 | return Some(body.local_decls[local].ty); |
| 1166 | } |
| 1167 | let local_node = ConstraintNode::Place(Place::from(local).as_ref()); |
| 1168 | pts.iter() |
| 1169 | .chain(points_to_map.get(&local_node).into_iter().flatten()) |
| 1170 | .find_map(|node| match node { |
| 1171 | ConstraintNode::Alloc(place) | ConstraintNode::Place(place) |
| 1172 | if is_parameter(place.local, body) => |
| 1173 | { |
| 1174 | Some(place.ty(body, tcx).ty) |
| 1175 | } |
| 1176 | _ => None, |
| 1177 | }) |
| 1178 | } |
| 1179 |
no test coverage detected