Skip to content

Commit 37e3f2f

Browse files
committed
librustc: De-@mut CrateContext::extern_const_values
1 parent d16cca1 commit 37e3f2f

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/librustc/middle/trans/context.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ pub struct CrateContext {
8787
const_values: RefCell<HashMap<ast::NodeId, ValueRef>>,
8888

8989
// Cache of external const values
90-
extern_const_values: HashMap<ast::DefId, ValueRef>,
90+
extern_const_values: RefCell<HashMap<ast::DefId, ValueRef>>,
9191

9292
impl_method_cache: HashMap<(ast::DefId, ast::Name), ast::DefId>,
9393

@@ -200,7 +200,7 @@ impl CrateContext {
200200
const_cstr_cache: RefCell::new(HashMap::new()),
201201
const_globals: RefCell::new(HashMap::new()),
202202
const_values: RefCell::new(HashMap::new()),
203-
extern_const_values: HashMap::new(),
203+
extern_const_values: RefCell::new(HashMap::new()),
204204
impl_method_cache: HashMap::new(),
205205
module_data: HashMap::new(),
206206
lltypes: HashMap::new(),

src/librustc/middle/trans/expr.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,8 +1018,10 @@ fn trans_lvalue_unadjusted(bcx: @Block, expr: &ast::Expr) -> DatumBlock {
10181018
PointerCast(bcx, val, pty)
10191019
} else {
10201020
{
1021-
let extern_const_values = &bcx.ccx().extern_const_values;
1022-
match extern_const_values.find(&did) {
1021+
let extern_const_values = bcx.ccx()
1022+
.extern_const_values
1023+
.borrow();
1024+
match extern_const_values.get().find(&did) {
10231025
None => {} // Continue.
10241026
Some(llval) => {
10251027
return *llval;
@@ -1037,8 +1039,9 @@ fn trans_lvalue_unadjusted(bcx: @Block, expr: &ast::Expr) -> DatumBlock {
10371039
llty.to_ref(),
10381040
buf)
10391041
});
1040-
let extern_const_values = &mut bcx.ccx().extern_const_values;
1041-
extern_const_values.insert(did, llval);
1042+
let mut extern_const_values =
1043+
bcx.ccx().extern_const_values.borrow_mut();
1044+
extern_const_values.get().insert(did, llval);
10421045
llval
10431046
}
10441047
}

0 commit comments

Comments
 (0)