aboutsummaryrefslogtreecommitdiff
path: root/src/test/run-pass/alt-pattern-drop.rs
blob: 4adf2f3a83f552cdc1ca95b12bdca64f9ae6e52f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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 "?"; fail; }
  }

  log _str.refcount(s);
  check (_str.refcount(s) == 2u);
}