let a = m1.lock().unwrap();
let b = m2.lock().unwrap();
let c = a; // c is created by move rather than call lock fn!
let d = b; // d is created by move rather than call lock fn!
a (m1) lives before b (m2), and b (m2) lives before c (m1).
The buggy logic assumes m1 and m2 conflict.
But c is created by moving from a rather than by calling lock fn!
So b living before c shall not be taken into account in conflict-lock.
Solution:
check if either of a pair of lockguards is created only by moving.
If so, then do not add the pair to ConflictLockGraph.
FP reason:
a (m1) lives before b (m2), and b (m2) lives before c (m1). The buggy logic assumes m1 and m2 conflict. But c is created by moving from a rather than by calling lock fn! So b living before c shall not be taken into account in conflict-lock.
Solution: check if either of a pair of lockguards is created only by moving. If so, then do not add the pair to ConflictLockGraph.