//# publish module 0x42.B { struct T has drop {g: u64} public new(g: u64): Self.T { label b0: return T{g: move(g)}; } public t(this: &mut Self.T) { let g: &mut u64; label b0: g = &mut copy(this).T::g; *copy(g) = 2; assert(*move(g) == 2, 42); _ = move(this); return; } } //# publish module 0x42.A { import 0x42.B; struct T has drop {f: B.T} public new(f: B.T): Self.T { label b0: return T{f: move(f)}; } public t(this: &mut Self.T) { let f: &mut B.T; label b0: f = &mut copy(this).T::f; // safe to modify reference through nested calls B.t(move(f)); _ = move(this); return; } } //# run import 0x42.A; import 0x42.B; main() { let b: B.T; let x: A.T; let x_ref: &mut A.T; label b0: b = B.new(0); x = A.new(move(b)); x_ref = &mut x; A.t(move(x_ref)); return; }