librustc: De-@mut llupvars in the translation crate context
This commit is contained in:
parent
de3d581198
commit
7ffba5c3e1
4 changed files with 10 additions and 4 deletions
|
|
@ -69,6 +69,7 @@ use util::sha2::Sha256;
|
|||
use middle::trans::type_::Type;
|
||||
|
||||
use std::c_str::ToCStr;
|
||||
use std::cell::RefCell;
|
||||
use std::hashmap::HashMap;
|
||||
use std::libc::c_uint;
|
||||
use std::vec;
|
||||
|
|
@ -1693,7 +1694,7 @@ pub fn new_fn_ctxt_w_id(ccx: @CrateContext,
|
|||
caller_expects_out_pointer: uses_outptr,
|
||||
llargs: @mut HashMap::new(),
|
||||
lllocals: @mut HashMap::new(),
|
||||
llupvars: @mut HashMap::new(),
|
||||
llupvars: RefCell::new(HashMap::new()),
|
||||
id: id,
|
||||
param_substs: param_substs,
|
||||
span: sp,
|
||||
|
|
|
|||
|
|
@ -328,7 +328,11 @@ pub fn load_environment(fcx: @mut FunctionContext,
|
|||
ast::ManagedSigil | ast::OwnedSigil => {}
|
||||
}
|
||||
let def_id = ast_util::def_id_of_def(cap_var.def);
|
||||
fcx.llupvars.insert(def_id.node, upvarptr);
|
||||
|
||||
{
|
||||
let mut llupvars = fcx.llupvars.borrow_mut();
|
||||
llupvars.get().insert(def_id.node, upvarptr);
|
||||
}
|
||||
|
||||
for &env_pointer_alloca in env_pointer_alloca.iter() {
|
||||
debuginfo::create_captured_var_metadata(
|
||||
|
|
|
|||
|
|
@ -245,7 +245,7 @@ pub struct FunctionContext {
|
|||
// them in llallocas.
|
||||
lllocals: @mut HashMap<ast::NodeId, ValueRef>,
|
||||
// Same as above, but for closure upvars
|
||||
llupvars: @mut HashMap<ast::NodeId, ValueRef>,
|
||||
llupvars: RefCell<HashMap<ast::NodeId, ValueRef>>,
|
||||
|
||||
// The NodeId of the function, or -1 if it doesn't correspond to
|
||||
// a user-defined function.
|
||||
|
|
|
|||
|
|
@ -1084,7 +1084,8 @@ pub fn trans_local_var(bcx: @Block, def: ast::Def) -> Datum {
|
|||
ast::DefUpvar(nid, _, _, _) => {
|
||||
// Can't move upvars, so this is never a ZeroMemLastUse.
|
||||
let local_ty = node_id_type(bcx, nid);
|
||||
match bcx.fcx.llupvars.find(&nid) {
|
||||
let llupvars = bcx.fcx.llupvars.borrow();
|
||||
match llupvars.get().find(&nid) {
|
||||
Some(&val) => {
|
||||
Datum {
|
||||
val: val,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue