//# publish module 0x42.Tester { struct T has drop {v: u64} public new(v: u64): Self.T { label b0: return T{v: move(v)}; } public update(t: &mut Self.T) { let vref: &mut u64; label b0: vref = &mut move(t).T::v; *move(vref) = 1; return; } public vref(this: &mut Self.T): &u64 { let r: &u64; label b0: r = ©(this).T::v; _ = move(this); return move(r); } } //# run import 0x42.Tester; main() { let t: Tester.T; let tt: &mut Tester.T; let vref_before: &u64; let ref_t: &mut Tester.T; let vref_after: &u64; label b0: t = Tester.new(0); tt = &mut t; vref_before = Tester.vref(move(tt)); assert(*copy(vref_before) == 0, 42); ref_t = &mut t; Tester.update(copy(ref_t)); vref_after = Tester.vref(move(ref_t)); assert(*move(vref_before) == 1, 42); assert(*move(vref_after) == 1, 42); return; }