Skip to content

Commit e0e8194

Browse files
committed
---
yaml --- r: 90724 b: refs/heads/master c: 28943e9 h: refs/heads/master v: v3
1 parent 1605aac commit e0e8194

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 0e2041c54b3065cc285ae19744e8acbff7533890
2+
refs/heads/master: 28943e96cb0f0dfb05b3b5ce604c5a0fb8e24095
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a6d3e57dca68fde4effdda3e4ae2887aa535fcd6
55
refs/heads/try: b160761e35efcd1207112b3b782c06633cf441a8

trunk/src/librustc/middle/trans/consts.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ pub fn const_lit(cx: &mut CrateContext, e: &ast::Expr, lit: ast::lit)
7979
pub fn const_ptrcast(cx: &mut CrateContext, a: ValueRef, t: Type) -> ValueRef {
8080
unsafe {
8181
let b = llvm::LLVMConstPointerCast(a, t.ptr_to().to_ref());
82-
assert!(cx.const_globals.insert(b as int, a));
82+
let mut const_globals = cx.const_globals.borrow_mut();
83+
assert!(const_globals.get().insert(b as int, a));
8384
b
8485
}
8586
}
@@ -111,7 +112,8 @@ fn const_addr_of(cx: &mut CrateContext, cv: ValueRef) -> ValueRef {
111112
}
112113

113114
fn const_deref_ptr(cx: &mut CrateContext, v: ValueRef) -> ValueRef {
114-
let v = match cx.const_globals.find(&(v as int)) {
115+
let const_globals = cx.const_globals.borrow();
116+
let v = match const_globals.get().find(&(v as int)) {
115117
Some(&v) => v,
116118
None => v
117119
};

trunk/src/librustc/middle/trans/context.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ pub struct CrateContext {
8181
// when we ptrcast, and we have to ptrcast during translation
8282
// of a [T] const because we form a slice, a [*T,int] pair, not
8383
// a pointer to an LLVM array type.
84-
const_globals: HashMap<int, ValueRef>,
84+
const_globals: RefCell<HashMap<int, ValueRef>>,
8585

8686
// Cache of emitted const values
8787
const_values: HashMap<ast::NodeId, ValueRef>,
@@ -198,7 +198,7 @@ impl CrateContext {
198198
monomorphizing: RefCell::new(HashMap::new()),
199199
vtables: RefCell::new(HashMap::new()),
200200
const_cstr_cache: RefCell::new(HashMap::new()),
201-
const_globals: HashMap::new(),
201+
const_globals: RefCell::new(HashMap::new()),
202202
const_values: HashMap::new(),
203203
extern_const_values: HashMap::new(),
204204
impl_method_cache: HashMap::new(),

0 commit comments

Comments
 (0)