Find the diagnosis info for relation(a, b), including a's ty & span, b's ty & span, and callchains.
(
a: &LockGuardId,
b: &LockGuardId,
lockguards: &LockGuardMap<'tcx>,
callgraph: &CallGraph<'tcx>,
tcx: TyCtxt<'tcx>,
)
| 763 | let (caller, callee) = (window[0], window[1]); |
| 764 | let caller_instance = match callgraph.index_to_instance(caller).unwrap() { |
| 765 | CallGraphNode::WithBody(instance) => instance, |
| 766 | n => panic!("CallGraphNode {:?} must own body", n), |
| 767 | }; |
| 768 | let caller_body = tcx.instance_mir(caller_instance.def); |
| 769 | let callsites = callgraph.callsites(caller, callee).unwrap(); |
| 770 | callsites |
| 771 | .into_iter() |
| 772 | .filter_map(|location| { |
| 773 | location |
| 774 | .location() |
| 775 | .map(|loc| format!("{:?}", caller_body.source_info(loc).span)) |
| 776 | }) |
| 777 | .collect::<Vec<_>>() |
| 778 | }) |
| 779 | .collect::<Vec<_>>() |
| 780 | }) |
| 781 | .collect::<Vec<_>>() |
| 782 | } |
| 783 | |
| 784 | // Find the diagnosis info for relation(a, b), including a's ty & span, b's ty & span, and callchains. |
| 785 | fn diagnose_one_relation<'tcx>( |
| 786 | a: &LockGuardId, |
| 787 | b: &LockGuardId, |
| 788 | lockguards: &LockGuardMap<'tcx>, |
| 789 | callgraph: &CallGraph<'tcx>, |
| 790 | tcx: TyCtxt<'tcx>, |
| 791 | ) -> DeadlockDiagnosis { |
| 792 | let a_info = &lockguards[a]; |
| 793 | let b_info = &lockguards[b]; |
no test coverage detected