//# publish module 0x42.M { struct A{x: u64} struct B has drop {y: u64} public a(x: u64): Self.A { label b0: return A{x: move(x)}; } public b(y: u64): Self.B { label b0: return B{y: move(y)}; } public set_a_with_b(a: &mut Self.A, b: &Self.B) { let x_ref: &mut u64; let y_ref: &u64; label b0: x_ref = &mut copy(a).A::x; y_ref = ©(b).B::y; *move(x_ref) = *move(y_ref); _ = move(a); _ = move(b); return; } public set_b_with_a(b: &mut Self.B, a: &Self.A) { let x_ref: &u64; let y_ref: &mut u64; label b0: y_ref = &mut copy(b).B::y; x_ref = ©(a).A::x; *move(y_ref) = *move(x_ref); _ = move(a); _ = move(b); return; } public destroy_a(a: Self.A) { let x: u64; label b0: A{ x } = move(a); return; } } //# run import 0x42.M; main() { let a: M.A; let a_ref: &M.A; let a_mut_ref: &mut M.A; let b: M.B; let b_ref: &M.B; let b_mut_ref: &mut M.B; label b0: a = M.a(0); b = M.b(1); a_mut_ref = &mut a; b_ref = &b; // can call public functions M.set_a_with_b(move(a_mut_ref), move(b_ref)); a_ref = &a; b_mut_ref = &mut b; M.set_b_with_a(move(b_mut_ref), move(a_ref)); M.destroy_a(move(a)); return; }