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); }