Skip to content

Commit 94aafb8

Browse files
committed
---
yaml --- r: 88974 b: refs/heads/snap-stage3 c: af11840 h: refs/heads/master v: v3
1 parent e8c75f8 commit 94aafb8

File tree

4 files changed

+18
-10
lines changed

4 files changed

+18
-10
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: deeca5d586bfaa4aa60246f671a8d611d38f6248
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 3528f74335be6f28671277936d643efb16cbc6c7
4+
refs/heads/snap-stage3: af1184030bfaf73b280a83ddfa469a4e678728c9
55
refs/heads/try: b160761e35efcd1207112b3b782c06633cf441a8
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/librustc/back/link.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -853,7 +853,9 @@ fn link_rlib(sess: Session,
853853
out_filename: &Path) -> Archive {
854854
let mut a = Archive::create(sess, out_filename, obj_filename);
855855

856-
for &(ref l, kind) in sess.cstore.get_used_libraries().iter() {
856+
let used_libraries = sess.cstore.get_used_libraries();
857+
let used_libraries = used_libraries.borrow();
858+
for &(ref l, kind) in used_libraries.get().iter() {
857859
match kind {
858860
cstore::NativeStatic => {
859861
a.add_native_library(l.as_slice());
@@ -1116,7 +1118,9 @@ fn add_local_native_libraries(args: &mut ~[~str], sess: Session) {
11161118
args.push("-L" + path.as_str().unwrap().to_owned());
11171119
}
11181120

1119-
for &(ref l, kind) in sess.cstore.get_used_libraries().iter() {
1121+
let used_libraries = sess.cstore.get_used_libraries();
1122+
let used_libraries = used_libraries.borrow();
1123+
for &(ref l, kind) in used_libraries.get().iter() {
11201124
match kind {
11211125
cstore::NativeUnknown | cstore::NativeStatic => {
11221126
args.push("-l" + *l);

branches/snap-stage3/src/librustc/metadata/cstore.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ pub struct CStore {
6464
priv metas: RefCell<HashMap<ast::CrateNum, @crate_metadata>>,
6565
priv extern_mod_crate_map: RefCell<extern_mod_crate_map>,
6666
priv used_crate_sources: RefCell<~[CrateSource]>,
67-
priv used_libraries: ~[(~str, NativeLibaryKind)],
67+
priv used_libraries: RefCell<~[(~str, NativeLibaryKind)]>,
6868
priv used_link_args: ~[~str],
6969
intr: @ident_interner
7070
}
@@ -78,7 +78,7 @@ impl CStore {
7878
metas: RefCell::new(HashMap::new()),
7979
extern_mod_crate_map: RefCell::new(HashMap::new()),
8080
used_crate_sources: RefCell::new(~[]),
81-
used_libraries: ~[],
81+
used_libraries: RefCell::new(~[]),
8282
used_link_args: ~[],
8383
intr: intr
8484
}
@@ -137,15 +137,17 @@ impl CStore {
137137

138138
pub fn add_used_library(&mut self, lib: ~str, kind: NativeLibaryKind) -> bool {
139139
assert!(!lib.is_empty());
140-
if self.used_libraries.iter().any(|&(ref x, _)| x == &lib) {
140+
let mut used_libraries = self.used_libraries.borrow_mut();
141+
if used_libraries.get().iter().any(|&(ref x, _)| x == &lib) {
141142
return false;
142143
}
143-
self.used_libraries.push((lib, kind));
144+
used_libraries.get().push((lib, kind));
144145
true
145146
}
146147

147-
pub fn get_used_libraries<'a>(&'a self) -> &'a [(~str, NativeLibaryKind)] {
148-
self.used_libraries.as_slice()
148+
pub fn get_used_libraries<'a>(&'a self)
149+
-> &'a RefCell<~[(~str, NativeLibaryKind)]> {
150+
&self.used_libraries
149151
}
150152

151153
pub fn add_used_link_args(&mut self, args: &str) {

branches/snap-stage3/src/librustc/metadata/encoder.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1611,7 +1611,9 @@ fn encode_lang_items(ecx: &EncodeContext, ebml_w: &mut writer::Encoder) {
16111611
fn encode_native_libraries(ecx: &EncodeContext, ebml_w: &mut writer::Encoder) {
16121612
ebml_w.start_tag(tag_native_libraries);
16131613

1614-
for &(ref lib, kind) in ecx.cstore.get_used_libraries().iter() {
1614+
let used_libraries = ecx.tcx.sess.cstore.get_used_libraries();
1615+
let used_libraries = used_libraries.borrow();
1616+
for &(ref lib, kind) in used_libraries.get().iter() {
16151617
match kind {
16161618
cstore::NativeStatic => {} // these libraries are not propagated
16171619
cstore::NativeFramework | cstore::NativeUnknown => {

0 commit comments

Comments
 (0)