aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoy Frostig <[email protected]>2010-08-27 13:48:45 -0700
committerRoy Frostig <[email protected]>2010-08-27 13:48:45 -0700
commit0d15ae4f7a2429e70d7085e538e7ce305ef6a468 (patch)
tree45475c7880f6398eae994b9ec74cf1d6d4d721b0 /src
parentWhitespace shuffle in rustc's lexer to fit 78-column rule and put out burning... (diff)
downloadrust-0d15ae4f7a2429e70d7085e538e7ce305ef6a468.tar.xz
rust-0d15ae4f7a2429e70d7085e538e7ce305ef6a468.zip
Modify alt-pattern-drop.rs to also insure the slot bound in the pattern doesn't also get dropped (again) at the end of the block containing the alt.
Diffstat (limited to 'src')
-rw-r--r--src/test/run-pass/alt-pattern-drop.rs14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/test/run-pass/alt-pattern-drop.rs b/src/test/run-pass/alt-pattern-drop.rs
index 4adf2f3a..68e4f13e 100644
--- a/src/test/run-pass/alt-pattern-drop.rs
+++ b/src/test/run-pass/alt-pattern-drop.rs
@@ -5,15 +5,21 @@ import std._str;
type t = tag(make_t(str), clam());
-fn main() {
- let str s = "hi"; // ref up
+fn foo(str s) {
let t x = make_t(s); // ref up
alt (x) {
- case (make_t(y)) { log y; } // ref up and ref down
+ case (make_t(y)) { log y; } // ref up then down
case (_) { log "?"; fail; }
}
log _str.refcount(s);
- check (_str.refcount(s) == 2u);
+ check (_str.refcount(s) == 3u);
+}
+
+fn main() {
+ let str s = "hi"; // ref up
+ foo(s); // ref up then down
+ log _str.refcount(s);
+ check (_str.refcount(s) == 1u);
}