mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-29 18:23:49 +00:00
librustc: De-@mut
the cnum_map
This commit is contained in:
parent
5a9c37b7f5
commit
620be9235d
@ -15,6 +15,7 @@ use metadata::cstore;
|
||||
use metadata::decoder;
|
||||
use metadata::loader;
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::hashmap::HashMap;
|
||||
use syntax::ast;
|
||||
use syntax::abi;
|
||||
@ -347,5 +348,5 @@ fn resolve_crate_deps(e: &mut Env, cdata: &[u8]) -> cstore::cnum_map {
|
||||
}
|
||||
}
|
||||
}
|
||||
return @mut cnum_map;
|
||||
return @RefCell::new(cnum_map);
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ use syntax::parse::token::ident_interner;
|
||||
// local crate numbers (as generated during this session). Each external
|
||||
// crate may refer to types in other external crates, and each has their
|
||||
// own crate numbers.
|
||||
pub type cnum_map = @mut HashMap<ast::CrateNum, ast::CrateNum>;
|
||||
pub type cnum_map = @RefCell<HashMap<ast::CrateNum, ast::CrateNum>>;
|
||||
|
||||
pub enum MetadataBlob {
|
||||
MetadataVec(~[u8]),
|
||||
|
@ -1197,9 +1197,15 @@ pub fn translate_def_id(cdata: Cmd, did: ast::DefId) -> ast::DefId {
|
||||
return ast::DefId { crate: cdata.cnum, node: did.node };
|
||||
}
|
||||
|
||||
match cdata.cnum_map.find(&did.crate) {
|
||||
option::Some(&n) => ast::DefId { crate: n, node: did.node },
|
||||
option::None => fail!("didn't find a crate in the cnum_map")
|
||||
let cnum_map = cdata.cnum_map.borrow();
|
||||
match cnum_map.get().find(&did.crate) {
|
||||
Some(&n) => {
|
||||
ast::DefId {
|
||||
crate: n,
|
||||
node: did.node,
|
||||
}
|
||||
}
|
||||
None => fail!("didn't find a crate in the cnum_map")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ pub fn check_crate(
|
||||
capture_map: capture_map,
|
||||
root_map: root_map(),
|
||||
write_guard_map: @RefCell::new(HashSet::new()),
|
||||
stats: @mut BorrowStats {
|
||||
stats: @BorrowStats {
|
||||
loaned_paths_same: Cell::new(0),
|
||||
loaned_paths_imm: Cell::new(0),
|
||||
stable_paths: Cell::new(0),
|
||||
@ -172,7 +172,7 @@ pub struct BorrowckCtxt {
|
||||
write_guard_map: write_guard_map,
|
||||
|
||||
// Statistics:
|
||||
stats: @mut BorrowStats
|
||||
stats: @BorrowStats
|
||||
}
|
||||
|
||||
pub struct BorrowStats {
|
||||
|
Loading…
Reference in New Issue
Block a user