Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Modify alt-pattern-drop.rs to also insure the slot bound in the patte…
…rn doesn't also get dropped (again) at the end of the block containing the alt.
  • Loading branch information
froystig committed Aug 27, 2010
1 parent 6f52ba7 commit 0d15ae4
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/test/run-pass/alt-pattern-drop.rs
Expand Up @@ -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);
}

0 comments on commit 0d15ae4

Please sign in to comment.