librustc: De-@mut CStore::used_link_args

This commit is contained in:
Patrick Walton 2013-12-20 19:56:29 -08:00
parent af1184030b
commit 79d97ca4aa
2 changed files with 9 additions and 6 deletions

View file

@ -1089,7 +1089,9 @@ fn link_args(sess: Session,
// Finally add all the linker arguments provided on the command line along
// with any #[link_args] attributes found inside the crate
args.push_all(sess.opts.linker_args);
for arg in sess.cstore.get_used_link_args().iter() {
let used_link_args = sess.cstore.get_used_link_args();
let used_link_args = used_link_args.borrow();
for arg in used_link_args.get().iter() {
args.push(arg.clone());
}
return args;

View file

@ -65,7 +65,7 @@ pub struct CStore {
priv extern_mod_crate_map: RefCell<extern_mod_crate_map>,
priv used_crate_sources: RefCell<~[CrateSource]>,
priv used_libraries: RefCell<~[(~str, NativeLibaryKind)]>,
priv used_link_args: ~[~str],
priv used_link_args: RefCell<~[~str]>,
intr: @ident_interner
}
@ -79,7 +79,7 @@ impl CStore {
extern_mod_crate_map: RefCell::new(HashMap::new()),
used_crate_sources: RefCell::new(~[]),
used_libraries: RefCell::new(~[]),
used_link_args: ~[],
used_link_args: RefCell::new(~[]),
intr: intr
}
}
@ -151,13 +151,14 @@ impl CStore {
}
pub fn add_used_link_args(&mut self, args: &str) {
let mut used_link_args = self.used_link_args.borrow_mut();
for s in args.split(' ') {
self.used_link_args.push(s.to_owned());
used_link_args.get().push(s.to_owned());
}
}
pub fn get_used_link_args<'a>(&'a self) -> &'a [~str] {
self.used_link_args.as_slice()
pub fn get_used_link_args<'a>(&'a self) -> &'a RefCell<~[~str]> {
&self.used_link_args
}
pub fn add_extern_mod_stmt_cnum(&mut self,