X = Arc::clone(rhs) or X = ptr::read(rhs) ? = &X rhs--|alias_copy|-->X, X--|address|-->?
(&self, rhs: &ConstraintNode<'tcx>)
| 355 | /// rhs--|alias_copy|-->X, |
| 356 | /// X--|address|-->? |
| 357 | fn alias_copy_targets(&self, rhs: &ConstraintNode<'tcx>) -> Vec<ConstraintNode<'tcx>> { |
| 358 | let rhs = self.get_node(rhs).unwrap(); |
| 359 | self.graph |
| 360 | .edges_directed(rhs, Direction::Outgoing) |
| 361 | .filter_map(|edge| { |
| 362 | if *edge.weight() == ConstraintEdge::AliasCopy { |
| 363 | Some(edge.target()) |
| 364 | } else { |
| 365 | None |
| 366 | } |
| 367 | }) |
| 368 | .fold(Vec::new(), |mut acc, copy_alias_target| { |
| 369 | let address_targets = self |
| 370 | .graph |
| 371 | .edges_directed(copy_alias_target, Direction::Outgoing) |
| 372 | .filter_map(|edge| { |
| 373 | if *edge.weight() == ConstraintEdge::Address { |
| 374 | Some(self.graph.node_weight(edge.target()).cloned().unwrap()) |
| 375 | } else { |
| 376 | None |
| 377 | } |
| 378 | }); |
| 379 | acc.extend(address_targets); |
| 380 | acc |
| 381 | }) |
| 382 | } |
| 383 | |
| 384 | /// if edge `from--|weight|-->to` not exists, |
| 385 | /// then add the edge and return true |
no test coverage detected