diff --git a/src/librustc/middle/borrowck/check_loans.rs b/src/librustc/middle/borrowck/check_loans.rs index f2a6336f3b8..6176f5601c1 100644 --- a/src/librustc/middle/borrowck/check_loans.rs +++ b/src/librustc/middle/borrowck/check_loans.rs @@ -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; } diff --git a/src/librustc/middle/borrowck/gather_loans/mod.rs b/src/librustc/middle/borrowck/gather_loans/mod.rs index 8476b27ddb6..fa0af8526cf 100644 --- a/src/librustc/middle/borrowck/gather_loans/mod.rs +++ b/src/librustc/middle/borrowck/gather_loans/mod.rs @@ -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); diff --git a/src/librustc/middle/lint.rs b/src/librustc/middle/lint.rs index fd4b97aca18..abba8872532 100644 --- a/src/librustc/middle/lint.rs +++ b/src/librustc/middle/lint.rs @@ -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"); } diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index 4e6020164b3..2a2245cfe26 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -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, + used_mut_nodes: RefCell>, // 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(),