File tree Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -154,9 +154,12 @@ pub fn lookup_const_by_id(tcx: ty::ctxt,
154
154
Some ( _) => None
155
155
}
156
156
} else {
157
- match tcx. extern_const_statics . find ( & def_id) {
158
- Some ( & e) => return e,
159
- None => { }
157
+ {
158
+ let extern_const_statics = tcx. extern_const_statics . borrow ( ) ;
159
+ match extern_const_statics. get ( ) . find ( & def_id) {
160
+ Some ( & e) => return e,
161
+ None => { }
162
+ }
160
163
}
161
164
let maps = astencode:: Maps {
162
165
root_map : @mut HashMap :: new ( ) ,
@@ -173,8 +176,12 @@ pub fn lookup_const_by_id(tcx: ty::ctxt,
173
176
} ,
174
177
_ => None
175
178
} ;
176
- tcx. extern_const_statics . insert ( def_id, e) ;
177
- return e;
179
+ {
180
+ let mut extern_const_statics = tcx. extern_const_statics
181
+ . borrow_mut ( ) ;
182
+ extern_const_statics. get ( ) . insert ( def_id, e) ;
183
+ return e;
184
+ }
178
185
}
179
186
}
180
187
Original file line number Diff line number Diff line change @@ -368,7 +368,7 @@ struct ctxt_ {
368
368
369
369
// These two caches are used by const_eval when decoding external statics
370
370
// and variants that are found.
371
- extern_const_statics : @ mut HashMap < ast:: DefId , Option < @ast:: Expr > > ,
371
+ extern_const_statics : RefCell < HashMap < ast:: DefId , Option < @ast:: Expr > > > ,
372
372
extern_const_variants : @mut HashMap < ast:: DefId , Option < @ast:: Expr > > ,
373
373
}
374
374
@@ -1014,7 +1014,7 @@ pub fn mk_ctxt(s: session::Session,
1014
1014
populated_external_types : @mut HashSet :: new ( ) ,
1015
1015
populated_external_traits : @mut HashSet :: new ( ) ,
1016
1016
1017
- extern_const_statics : @ mut HashMap :: new ( ) ,
1017
+ extern_const_statics : RefCell :: new ( HashMap :: new ( ) ) ,
1018
1018
extern_const_variants : @mut HashMap :: new ( ) ,
1019
1019
}
1020
1020
}
You can’t perform that action at this time.
0 commit comments