@@ -308,7 +308,7 @@ struct ctxt_ {
308
308
tcache : type_cache ,
309
309
rcache : creader_cache ,
310
310
short_names_cache : RefCell < HashMap < t , @str > > ,
311
- needs_unwind_cleanup_cache : @ mut HashMap < t , bool > ,
311
+ needs_unwind_cleanup_cache : RefCell < HashMap < t , bool > > ,
312
312
tc_cache : @mut HashMap < uint , TypeContents > ,
313
313
ast_ty_to_ty_cache : @mut HashMap < NodeId , ast_ty_to_ty_cache_entry > ,
314
314
enum_var_cache : @mut HashMap < DefId , @~[ @VariantInfo ] > ,
@@ -994,7 +994,7 @@ pub fn mk_ctxt(s: session::Session,
994
994
tcache : @mut HashMap :: new ( ) ,
995
995
rcache : mk_rcache ( ) ,
996
996
short_names_cache : RefCell :: new ( HashMap :: new ( ) ) ,
997
- needs_unwind_cleanup_cache : new_ty_hash ( ) ,
997
+ needs_unwind_cleanup_cache : RefCell :: new ( HashMap :: new ( ) ) ,
998
998
tc_cache : @mut HashMap :: new ( ) ,
999
999
ast_ty_to_ty_cache : @mut HashMap :: new ( ) ,
1000
1000
enum_var_cache : @mut HashMap :: new ( ) ,
@@ -1668,15 +1668,21 @@ pub fn type_needs_drop(cx: ctxt, ty: t) -> bool {
1668
1668
// that only contain scalars and shared boxes can avoid unwind
1669
1669
// cleanups.
1670
1670
pub fn type_needs_unwind_cleanup ( cx : ctxt , ty : t ) -> bool {
1671
- match cx. needs_unwind_cleanup_cache . find ( & ty) {
1672
- Some ( & result) => return result,
1673
- None => ( )
1671
+ {
1672
+ let needs_unwind_cleanup_cache = cx. needs_unwind_cleanup_cache
1673
+ . borrow ( ) ;
1674
+ match needs_unwind_cleanup_cache. get ( ) . find ( & ty) {
1675
+ Some ( & result) => return result,
1676
+ None => ( )
1677
+ }
1674
1678
}
1675
1679
1676
1680
let mut tycache = HashSet :: new ( ) ;
1677
1681
let needs_unwind_cleanup =
1678
1682
type_needs_unwind_cleanup_ ( cx, ty, & mut tycache, false ) ;
1679
- cx. needs_unwind_cleanup_cache . insert ( ty, needs_unwind_cleanup) ;
1683
+ let mut needs_unwind_cleanup_cache = cx. needs_unwind_cleanup_cache
1684
+ . borrow_mut ( ) ;
1685
+ needs_unwind_cleanup_cache. get ( ) . insert ( ty, needs_unwind_cleanup) ;
1680
1686
return needs_unwind_cleanup;
1681
1687
}
1682
1688
0 commit comments