## Source ```rust= struct T {} fn test(cond: bool) { let mut x = T {}; let mut y = T {}; let mut a: &mut T; let x1: &mut T; let y1: &mut T; let mut a: &mut T; if cond { a = &mut x; x1 = &mut (*a); y1 = &mut y; // x1 -> a -> x // y1 -> y } else { a = &mut y; x1 = &mut x; y1 = &mut (*a); // x1 -> x // y1 -> a -> y } let test_x1 = x1; let test_y1 = y1; let test_x = x; let test_y = y; } fn main() {} ``` ## Explanation Simple version of [Example: Triangular Coupling ](/zAEksPVRSZ-cEeILIvBPAQ). ``` Graph 1: { x1, y1 } x1 -1-> a -2-> x y1 -3-> y Graph 2: { x1, y1 } x1 -1-> x y1 -3-> a -2-> y -- next: can def access a Sig 1: { x1 } #1 { a } Sig 2: { y1 } #3 { a } > def consume x1 Sig 1: { x1 } #1 { a } Sig 2: { x1,y1 } #3,#1 { a,x } > def consume y1 Sig 1: { x1,y1 } #1,#3 { a,y } Sig 2: { x1,y1 } #3,#1 { a,x } > LHS: agree > RHS: freeze extras Sig 1: { x1,y1 } #1,#3,freeze(y) { a,|y| } Sig 2: { x1,y1 } #3,#1,freeze(x) { a,|x| } Coupled edge: { x1, y1 } --* { a } Graph 1: { a, |y| } a -2-> x Graph 2: { a, |x| } a -2-> y -- Next: can def access x Sig 1: { a } #2 { x } Sig 2: { |x| } unfreeze(x) { x } > Def consume a Sig 1: { a } #2 { x } Sig 2: { |x|, a } unfreeze(x),#2 { x, y } > LHS: agrees > RHS: can def access y now too, unfreeze Sig 1: { a,|y| } #2,unfreeze(y) { x, y } Sig 2: { |x|, a } unfreeze(x),#2 { x, y } Coupled edge: { a } --* { x, y } Graph 1: { x, y } (empty) Graph 2: { x, y } (empty) Representation in analysis state: ``` ![](https://hackmd.io/_uploads/rk9yzKbo2.png)