From 5e77e784f006e36c06252d9beccbd7893eddac73 Mon Sep 17 00:00:00 2001 From: Roy Frostig Date: Fri, 27 Aug 2010 13:27:28 -0700 Subject: Have alt-pattern drop the slots it initializes when binding slot patterns. Add a testcase for this as well. --- src/test/run-pass/alt-pattern-drop.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/test/run-pass/alt-pattern-drop.rs (limited to 'src/test') diff --git a/src/test/run-pass/alt-pattern-drop.rs b/src/test/run-pass/alt-pattern-drop.rs new file mode 100644 index 00000000..d1f1440f --- /dev/null +++ b/src/test/run-pass/alt-pattern-drop.rs @@ -0,0 +1,19 @@ +// -*- rust -*- + +use std; +import std._str; + +type t = tag(make_t(str), clam()); + +fn main() { + let str s = "hi"; // ref up + let t x = make_t(s); // ref up + + alt (x) { + case (make_t(y)) { log y; } // ref up and ref down + case (_) { log "?"; } + } + + log _str.refcount(s); + check (_str.refcount(s) == 2u); +} -- cgit v1.2.3