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 @@ -111,9 +111,12 @@ pub fn lookup_variant_by_id(tcx: ty::ctxt,
111
111
Some ( _) => None
112
112
}
113
113
} else {
114
- match tcx. extern_const_variants . find ( & variant_def) {
115
- Some ( & e) => return e,
116
- None => { }
114
+ {
115
+ let extern_const_variants = tcx. extern_const_variants . borrow ( ) ;
116
+ match extern_const_variants. get ( ) . find ( & variant_def) {
117
+ Some ( & e) => return e,
118
+ None => { }
119
+ }
117
120
}
118
121
let maps = astencode:: Maps {
119
122
root_map : @mut HashMap :: new ( ) ,
@@ -136,8 +139,12 @@ pub fn lookup_variant_by_id(tcx: ty::ctxt,
136
139
} ,
137
140
_ => None
138
141
} ;
139
- tcx. extern_const_variants . insert ( variant_def, e) ;
140
- return e;
142
+ {
143
+ let mut extern_const_variants = tcx. extern_const_variants
144
+ . borrow_mut ( ) ;
145
+ extern_const_variants. get ( ) . insert ( variant_def, e) ;
146
+ return e;
147
+ }
141
148
}
142
149
}
143
150
Original file line number Diff line number Diff line change @@ -369,7 +369,7 @@ struct ctxt_ {
369
369
// These two caches are used by const_eval when decoding external statics
370
370
// and variants that are found.
371
371
extern_const_statics : RefCell < HashMap < ast:: DefId , Option < @ast:: Expr > > > ,
372
- extern_const_variants : @ mut HashMap < ast:: DefId , Option < @ast:: Expr > > ,
372
+ extern_const_variants : RefCell < HashMap < ast:: DefId , Option < @ast:: Expr > > > ,
373
373
}
374
374
375
375
pub enum tbox_flag {
@@ -1015,7 +1015,7 @@ pub fn mk_ctxt(s: session::Session,
1015
1015
populated_external_traits : @mut HashSet :: new ( ) ,
1016
1016
1017
1017
extern_const_statics : RefCell :: new ( HashMap :: new ( ) ) ,
1018
- extern_const_variants : @ mut HashMap :: new ( ) ,
1018
+ extern_const_variants : RefCell :: new ( HashMap :: new ( ) ) ,
1019
1019
}
1020
1020
}
1021
1021
You can’t perform that action at this time.
0 commit comments