Skip to content

Commit 17ff87b

Browse files
committed
---
yaml --- r: 90727 b: refs/heads/master c: 1185fcc h: refs/heads/master i: 90725: 55dcf30 90723: 1605aac 90719: 0f8181a v: v3
1 parent 923d65b commit 17ff87b

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
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: 37e3f2fe63a9e0a41d5ebca7d276401599f3e636
2+
refs/heads/master: 1185fcc437e13cd1d492509361c29d05ee2548f6
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a6d3e57dca68fde4effdda3e4ae2887aa535fcd6
55
refs/heads/try: b160761e35efcd1207112b3b782c06633cf441a8

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ pub struct CrateContext {
8989
// Cache of external const values
9090
extern_const_values: RefCell<HashMap<ast::DefId, ValueRef>>,
9191

92-
impl_method_cache: HashMap<(ast::DefId, ast::Name), ast::DefId>,
92+
impl_method_cache: RefCell<HashMap<(ast::DefId, ast::Name), ast::DefId>>,
9393

9494
module_data: HashMap<~str, ValueRef>,
9595
lltypes: HashMap<ty::t, Type>,
@@ -201,7 +201,7 @@ impl CrateContext {
201201
const_globals: RefCell::new(HashMap::new()),
202202
const_values: RefCell::new(HashMap::new()),
203203
extern_const_values: RefCell::new(HashMap::new()),
204-
impl_method_cache: HashMap::new(),
204+
impl_method_cache: RefCell::new(HashMap::new()),
205205
module_data: HashMap::new(),
206206
lltypes: HashMap::new(),
207207
llsizingtypes: HashMap::new(),

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -296,18 +296,22 @@ pub fn trans_static_method_callee(bcx: @Block,
296296
pub fn method_with_name(ccx: &mut CrateContext,
297297
impl_id: ast::DefId,
298298
name: ast::Name) -> ast::DefId {
299-
let meth_id_opt = ccx.impl_method_cache.find_copy(&(impl_id, name));
300-
match meth_id_opt {
301-
Some(m) => return m,
302-
None => {}
299+
{
300+
let impl_method_cache = ccx.impl_method_cache.borrow();
301+
let meth_id_opt = impl_method_cache.get().find_copy(&(impl_id, name));
302+
match meth_id_opt {
303+
Some(m) => return m,
304+
None => {}
305+
}
303306
}
304307

305308
let imp = ccx.tcx.impls.find(&impl_id)
306309
.expect("could not find impl while translating");
307310
let meth = imp.methods.iter().find(|m| m.ident.name == name)
308311
.expect("could not find method while translating");
309312

310-
ccx.impl_method_cache.insert((impl_id, name), meth.def_id);
313+
let mut impl_method_cache = ccx.impl_method_cache.borrow_mut();
314+
impl_method_cache.get().insert((impl_id, name), meth.def_id);
311315
meth.def_id
312316
}
313317

0 commit comments

Comments
 (0)