librustc: De-@mut the used_mut_nodes table in the type context

This commit is contained in:
Patrick Walton 2013-12-21 17:28:21 -08:00
parent 5c63b1febc
commit ccb18f47e2
4 changed files with 12 additions and 5 deletions

View File

@ -357,7 +357,10 @@ impl<'a> CheckLoanCtxt<'a> {
mc::cat_local(id) |
mc::cat_arg(id) |
mc::cat_self(id) => {
this.tcx().used_mut_nodes.insert(id);
let mut used_mut_nodes = this.tcx()
.used_mut_nodes
.borrow_mut();
used_mut_nodes.get().insert(id);
return;
}

View File

@ -607,7 +607,10 @@ impl<'a> GatherLoanCtxt<'a> {
match *loan_path {
LpVar(local_id) => {
self.tcx().used_mut_nodes.insert(local_id);
let mut used_mut_nodes = self.tcx()
.used_mut_nodes
.borrow_mut();
used_mut_nodes.get().insert(local_id);
}
LpExtend(base, mc::McInherited, _) => {
self.mark_loan_path_as_mutated(base);

View File

@ -1038,7 +1038,8 @@ fn check_unused_mut_pat(cx: &Context, p: &ast::Pat) {
}
};
if !initial_underscore && !cx.tcx.used_mut_nodes.contains(&p.id) {
let used_mut_nodes = cx.tcx.used_mut_nodes.borrow();
if !initial_underscore && !used_mut_nodes.get().contains(&p.id) {
cx.span_lint(unused_mut, p.span,
"variable does not need to be mutable");
}

View File

@ -353,7 +353,7 @@ struct ctxt_ {
// Set of nodes which mark locals as mutable which end up getting used at
// some point. Local variable definitions not in this set can be warned
// about.
used_mut_nodes: @mut HashSet<ast::NodeId>,
used_mut_nodes: RefCell<HashSet<ast::NodeId>>,
// vtable resolution information for impl declarations
impl_vtables: typeck::impl_vtable_map,
@ -1005,7 +1005,7 @@ pub fn mk_ctxt(s: session::Session,
inherent_impls: RefCell::new(HashMap::new()),
impls: RefCell::new(HashMap::new()),
used_unsafe: RefCell::new(HashSet::new()),
used_mut_nodes: @mut HashSet::new(),
used_mut_nodes: RefCell::new(HashSet::new()),
impl_vtables: RefCell::new(HashMap::new()),
populated_external_types: @mut HashSet::new(),
populated_external_traits: @mut HashSet::new(),