//# publish module 0x42.VTest { struct T has drop {fint: u64, fv: bool} public new(x: u64, y: bool): Self.T { label b0: return T{fint: move(x), fv: move(y)}; } public t1(this: &mut Self.T) { let x: &mut u64; label b0: x = &mut move(this).T::fint; *move(x) = 0; return; } public t2(this: &mut Self.T, i: u64) { let x: &mut u64; label b0: x = &mut move(this).T::fint; *move(x) = move(i); return; } public t3(this: &mut Self.T) { let x: &mut bool; label b0: x = &mut move(this).T::fv; *move(x) = *copy(x); return; } public t4(this: &mut Self.T, i: bool) { let x: &mut bool; label b0: x = &mut move(this).T::fv; *move(x) = move(i); return; } } //# publish module 0x42.RTest { struct T{fint: u64, fr: bool} public new(x: u64, y: bool): Self.T { label b0: return T{fint: move(x), fr: move(y)}; } public t1(this: &mut Self.T) { let x: &mut u64; label b0: x = &mut move(this).T::fint; *move(x) = 0; return; } public t2(this: &mut Self.T, i: u64) { let x: &mut u64; label b0: x = &mut move(this).T::fint; *move(x) = move(i); return; } public t3(this: &mut Self.T) { let x: &mut bool; let z: bool; label b0: x = &mut move(this).T::fr; z = true; *move(x) = move(z); return; } public t4(this: &mut Self.T, i: bool) { let x: &mut bool; label b0: x = &mut move(this).T::fr; *move(x) = move(i); return; } public destroy_t(t: Self.T) { let fint: u64; let fr: bool; label b0: T{ fint, fr } = move(t); return; } } //# run import 0x42.RTest; import 0x42.VTest; main() { let vt: VTest.T; let vref: &mut VTest.T; let rt: RTest.T; let rref: &mut RTest.T; label b0: vt = VTest.new(0, false); vref = &mut vt; rt = RTest.new(0, false); rref = &mut rt; VTest.t1(copy(vref)); RTest.t1(copy(rref)); VTest.t2(copy(vref), 0); RTest.t2(copy(rref), 0); VTest.t3(copy(vref)); RTest.t3(copy(rref)); VTest.t4(move(vref), false); RTest.t4(move(rref), false); RTest.destroy_t(move(rt)); return; }