@@ -232,7 +232,7 @@ pub type ctxt = @ctxt_;
232
232
233
233
struct ctxt_ {
234
234
diag : @syntax:: diagnostic:: span_handler ,
235
- interner : @mut HashMap < intern_key , t_box > ,
235
+ interner : @mut HashMap < intern_key , ~ t_box_ > ,
236
236
next_id : @mut uint ,
237
237
vecs_implicitly_copyable : bool ,
238
238
legacy_modes : bool ,
@@ -320,7 +320,7 @@ enum tbox_flag {
320
320
needs_subst = 1 | 2 | 8
321
321
}
322
322
323
- type t_box = @ t_box_ ;
323
+ type t_box = & ' static t_box_ ;
324
324
325
325
struct t_box_ {
326
326
sty : sty ,
@@ -903,7 +903,7 @@ fn mk_t(cx: ctxt, +st: sty) -> t { mk_t_with_id(cx, st, None) }
903
903
fn mk_t_with_id ( cx : ctxt , +st : sty , o_def_id : Option < ast:: def_id > ) -> t {
904
904
let key = intern_key { sty : to_unsafe_ptr ( & st) , o_def_id : o_def_id } ;
905
905
match cx. interner . find ( & key) {
906
- Some ( & t) => unsafe { return cast:: reinterpret_cast ( & t) ; } ,
906
+ Some ( t) => unsafe { return cast:: transmute ( & t. sty ) ; } ,
907
907
_ => ( )
908
908
}
909
909
@@ -973,21 +973,27 @@ fn mk_t_with_id(cx: ctxt, +st: sty, o_def_id: Option<ast::def_id>) -> t {
973
973
}
974
974
}
975
975
976
- let t = @ t_box_ {
976
+ let t = ~ t_box_ {
977
977
sty : st,
978
978
id : * cx. next_id ,
979
979
flags : flags,
980
980
o_def_id : o_def_id
981
981
} ;
982
+
983
+ let sty_ptr = to_unsafe_ptr ( & t. sty ) ;
984
+
982
985
let key = intern_key {
983
- sty : to_unsafe_ptr ( & t . sty ) ,
986
+ sty : sty_ptr ,
984
987
o_def_id : o_def_id
985
988
} ;
986
989
987
990
cx. interner . insert ( key, t) ;
988
991
989
992
* cx. next_id += 1 ;
990
- unsafe { cast:: reinterpret_cast ( & t) }
993
+
994
+ unsafe {
995
+ cast:: transmute :: < * sty , t > ( sty_ptr)
996
+ }
991
997
}
992
998
993
999
pub fn mk_nil ( cx : ctxt ) -> t { mk_t ( cx, ty_nil) }
0 commit comments