Find all the callchains: source -> target e.g., for one path: source --|callsites1|--> medium --|callsites2|--> target, first extract callsite locations on edge, namely, [callsites1, callsites2], then map locations to spans [spans1, spans2].
(
source: InstanceId,
target: InstanceId,
callgraph: &CallGraph<'tcx>,
tcx: TyCtxt<'tcx>,
)
| 729 | ApproximateAliasKind::Unknown => DeadlockPossibility::Unknown, |
| 730 | }, |
| 731 | _ => DeadlockPossibility::Unlikely, |
| 732 | }; |
| 733 | (possibility, NotDeadlockReason::TrueDeadlock) |
| 734 | } |
| 735 | |
| 736 | /// Generate doublelock diagnosis. |
| 737 | fn diagnose_doublelock<'tcx>( |
| 738 | a: &LockGuardId, |
| 739 | b: &LockGuardId, |
| 740 | lockguards: &LockGuardMap<'tcx>, |
| 741 | callgraph: &CallGraph<'tcx>, |
| 742 | tcx: TyCtxt<'tcx>, |
| 743 | ) -> report::DeadlockDiagnosis { |
| 744 | diagnose_one_relation(a, b, lockguards, callgraph, tcx) |
| 745 | } |
| 746 | |
| 747 | /// Find all the callchains: source -> target |
| 748 | // e.g., for one path: source --|callsites1|--> medium --|callsites2|--> target, |
| 749 | // first extract callsite locations on edge, namely, [callsites1, callsites2], |
| 750 | // then map locations to spans [spans1, spans2]. |
| 751 | fn track_callchains<'tcx>( |
| 752 | source: InstanceId, |
| 753 | target: InstanceId, |
| 754 | callgraph: &CallGraph<'tcx>, |
| 755 | tcx: TyCtxt<'tcx>, |
| 756 | ) -> Vec<Vec<Vec<String>>> { |
| 757 | let paths = callgraph.all_simple_paths(source, target); |
| 758 | paths |
| 759 | .into_iter() |
| 760 | .map(|vec| { |
| 761 | vec.windows(2) |
| 762 | .map(|window| { |
| 763 | let (caller, callee) = (window[0], window[1]); |
| 764 | let caller_instance = match callgraph.index_to_instance(caller).unwrap() { |
| 765 | CallGraphNode::WithBody(instance) => instance, |
no test coverage detected