diff options
| author | Roy Frostig <[email protected]> | 2010-08-27 13:27:28 -0700 |
|---|---|---|
| committer | Roy Frostig <[email protected]> | 2010-08-27 13:29:53 -0700 |
| commit | 5e77e784f006e36c06252d9beccbd7893eddac73 (patch) | |
| tree | 6bfd1a030a7d5c38cc07c88df4efa9874ffb2b70 /src/test/run-pass/alt-pattern-drop.rs | |
| parent | Modify rustboot to use lexer.reader. (diff) | |
| download | rust-5e77e784f006e36c06252d9beccbd7893eddac73.tar.xz rust-5e77e784f006e36c06252d9beccbd7893eddac73.zip | |
Have alt-pattern drop the slots it initializes when binding slot patterns. Add a testcase for this as well.
Diffstat (limited to 'src/test/run-pass/alt-pattern-drop.rs')
| -rw-r--r-- | src/test/run-pass/alt-pattern-drop.rs | 19 |
1 files changed, 19 insertions, 0 deletions
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); +} |