//# publish module 0x1.Test { struct X { b: bool } struct T { i: u64, x: Self.X, b: bool } public new_x(): Self.X { label b0: return X { b: true }; } public new_t(x: Self.X): Self.T { label b0: return T { i: 0, x: move(x), b: false }; } public destroy_x(x: Self.X) { let b: bool; label b0: X { b } = move(x); return; } // can unpack a resource and return it public destroy_t(t: Self.T): u64 * Self.X * bool { let i: u64; let x: Self.X; let flag: bool; label b0: T { i, x, b: flag } = move(t); return move(i), move(x), move(flag); } } //# run import 0x1.Test; main() { let x: Test.X; let i: u64; let t: Test.T; let b: bool; label b0: x = Test.new_x(); t = Test.new_t(move(x)); i, x, b = Test.destroy_t(move(t)); Test.destroy_x(move(x)); return; }