librustc: De-@mut
the impl_trait_cache
This commit is contained in:
parent
02f13adaa3
commit
efdbd60a87
1 changed files with 12 additions and 6 deletions
|
@ -295,7 +295,7 @@ struct ctxt_ {
|
||||||
// A cache for the trait_methods() routine
|
// A cache for the trait_methods() routine
|
||||||
trait_methods_cache: RefCell<HashMap<DefId, @~[@Method]>>,
|
trait_methods_cache: RefCell<HashMap<DefId, @~[@Method]>>,
|
||||||
|
|
||||||
impl_trait_cache: @mut HashMap<ast::DefId, Option<@ty::TraitRef>>,
|
impl_trait_cache: RefCell<HashMap<ast::DefId, Option<@ty::TraitRef>>>,
|
||||||
|
|
||||||
trait_refs: @mut HashMap<NodeId, @TraitRef>,
|
trait_refs: @mut HashMap<NodeId, @TraitRef>,
|
||||||
trait_defs: @mut HashMap<DefId, @TraitDef>,
|
trait_defs: @mut HashMap<DefId, @TraitDef>,
|
||||||
|
@ -1001,7 +1001,7 @@ pub fn mk_ctxt(s: session::Session,
|
||||||
methods: RefCell::new(HashMap::new()),
|
methods: RefCell::new(HashMap::new()),
|
||||||
trait_method_def_ids: RefCell::new(HashMap::new()),
|
trait_method_def_ids: RefCell::new(HashMap::new()),
|
||||||
trait_methods_cache: RefCell::new(HashMap::new()),
|
trait_methods_cache: RefCell::new(HashMap::new()),
|
||||||
impl_trait_cache: @mut HashMap::new(),
|
impl_trait_cache: RefCell::new(HashMap::new()),
|
||||||
ty_param_defs: @mut HashMap::new(),
|
ty_param_defs: @mut HashMap::new(),
|
||||||
adjustments: @mut HashMap::new(),
|
adjustments: @mut HashMap::new(),
|
||||||
normalized_cache: new_ty_hash(),
|
normalized_cache: new_ty_hash(),
|
||||||
|
@ -3621,10 +3621,14 @@ pub fn trait_method_def_ids(cx: ctxt, id: ast::DefId) -> @~[DefId] {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn impl_trait_ref(cx: ctxt, id: ast::DefId) -> Option<@TraitRef> {
|
pub fn impl_trait_ref(cx: ctxt, id: ast::DefId) -> Option<@TraitRef> {
|
||||||
match cx.impl_trait_cache.find(&id) {
|
{
|
||||||
Some(&ret) => { return ret; }
|
let mut impl_trait_cache = cx.impl_trait_cache.borrow_mut();
|
||||||
None => {}
|
match impl_trait_cache.get().find(&id) {
|
||||||
|
Some(&ret) => { return ret; }
|
||||||
|
None => {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let ret = if id.crate == ast::LOCAL_CRATE {
|
let ret = if id.crate == ast::LOCAL_CRATE {
|
||||||
debug!("(impl_trait_ref) searching for trait impl {:?}", id);
|
debug!("(impl_trait_ref) searching for trait impl {:?}", id);
|
||||||
match cx.items.find(&id.node) {
|
match cx.items.find(&id.node) {
|
||||||
|
@ -3642,7 +3646,9 @@ pub fn impl_trait_ref(cx: ctxt, id: ast::DefId) -> Option<@TraitRef> {
|
||||||
} else {
|
} else {
|
||||||
csearch::get_impl_trait(cx, id)
|
csearch::get_impl_trait(cx, id)
|
||||||
};
|
};
|
||||||
cx.impl_trait_cache.insert(id, ret);
|
|
||||||
|
let mut impl_trait_cache = cx.impl_trait_cache.borrow_mut();
|
||||||
|
impl_trait_cache.get().insert(id, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue