Skip to content

Commit 3ffaaab

Browse files
committed
librustc: Switch the @s in types with ~
1 parent af42d37 commit 3ffaaab

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

src/librustc/middle/ty.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ pub type ctxt = @ctxt_;
232232

233233
struct ctxt_ {
234234
diag: @syntax::diagnostic::span_handler,
235-
interner: @mut HashMap<intern_key, t_box>,
235+
interner: @mut HashMap<intern_key, ~t_box_>,
236236
next_id: @mut uint,
237237
vecs_implicitly_copyable: bool,
238238
legacy_modes: bool,
@@ -320,7 +320,7 @@ enum tbox_flag {
320320
needs_subst = 1 | 2 | 8
321321
}
322322

323-
type t_box = @t_box_;
323+
type t_box = &'static t_box_;
324324

325325
struct t_box_ {
326326
sty: sty,
@@ -903,7 +903,7 @@ fn mk_t(cx: ctxt, +st: sty) -> t { mk_t_with_id(cx, st, None) }
903903
fn mk_t_with_id(cx: ctxt, +st: sty, o_def_id: Option<ast::def_id>) -> t {
904904
let key = intern_key { sty: to_unsafe_ptr(&st), o_def_id: o_def_id };
905905
match cx.interner.find(&key) {
906-
Some(&t) => unsafe { return cast::reinterpret_cast(&t); },
906+
Some(t) => unsafe { return cast::transmute(&t.sty); },
907907
_ => ()
908908
}
909909

@@ -973,21 +973,27 @@ fn mk_t_with_id(cx: ctxt, +st: sty, o_def_id: Option<ast::def_id>) -> t {
973973
}
974974
}
975975

976-
let t = @t_box_ {
976+
let t = ~t_box_ {
977977
sty: st,
978978
id: *cx.next_id,
979979
flags: flags,
980980
o_def_id: o_def_id
981981
};
982+
983+
let sty_ptr = to_unsafe_ptr(&t.sty);
984+
982985
let key = intern_key {
983-
sty: to_unsafe_ptr(&t.sty),
986+
sty: sty_ptr,
984987
o_def_id: o_def_id
985988
};
986989

987990
cx.interner.insert(key, t);
988991

989992
*cx.next_id += 1;
990-
unsafe { cast::reinterpret_cast(&t) }
993+
994+
unsafe {
995+
cast::transmute::<*sty, t>(sty_ptr)
996+
}
991997
}
992998

993999
pub fn mk_nil(cx: ctxt) -> t { mk_t(cx, ty_nil) }

src/test/bench/core-map.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ fn vector<M: Map<uint, uint>>(map: &mut M, n_keys: uint, dist: &[uint]) {
8888
}
8989
}
9090

91+
#[fixed_stack_segment]
9192
fn main() {
9293
let args = os::args();
9394
let n_keys = {

0 commit comments

Comments
 (0)