librustc: Switch the @s in types with ~

This commit is contained in:
Patrick Walton 2013-04-01 15:33:21 -07:00
parent af42d37547
commit 3ffaaab9e9
2 changed files with 13 additions and 6 deletions

View File

@ -232,7 +232,7 @@ pub struct ProvidedMethodSource {
struct ctxt_ {
diag: @syntax::diagnostic::span_handler,
interner: @mut HashMap<intern_key, t_box>,
interner: @mut HashMap<intern_key, ~t_box_>,
next_id: @mut uint,
vecs_implicitly_copyable: bool,
legacy_modes: bool,
@ -320,7 +320,7 @@ enum tbox_flag {
needs_subst = 1 | 2 | 8
}
type t_box = @t_box_;
type t_box = &'static t_box_;
struct t_box_ {
sty: sty,
@ -903,7 +903,7 @@ fn mk_t(cx: ctxt, +st: sty) -> t { mk_t_with_id(cx, st, None) }
fn mk_t_with_id(cx: ctxt, +st: sty, o_def_id: Option<ast::def_id>) -> t {
let key = intern_key { sty: to_unsafe_ptr(&st), o_def_id: o_def_id };
match cx.interner.find(&key) {
Some(&t) => unsafe { return cast::reinterpret_cast(&t); },
Some(t) => unsafe { return cast::transmute(&t.sty); },
_ => ()
}
@ -973,21 +973,27 @@ fn sflags(substs: &substs) -> uint {
}
}
let t = @t_box_ {
let t = ~t_box_ {
sty: st,
id: *cx.next_id,
flags: flags,
o_def_id: o_def_id
};
let sty_ptr = to_unsafe_ptr(&t.sty);
let key = intern_key {
sty: to_unsafe_ptr(&t.sty),
sty: sty_ptr,
o_def_id: o_def_id
};
cx.interner.insert(key, t);
*cx.next_id += 1;
unsafe { cast::reinterpret_cast(&t) }
unsafe {
cast::transmute::<*sty, t>(sty_ptr)
}
}
pub fn mk_nil(cx: ctxt) -> t { mk_t(cx, ty_nil) }

View File

@ -88,6 +88,7 @@ fn vector<M: Map<uint, uint>>(map: &mut M, n_keys: uint, dist: &[uint]) {
}
}
#[fixed_stack_segment]
fn main() {
let args = os::args();
let n_keys = {