Skip to content

Commit cd82bb0

Browse files
committed
---
yaml --- r: 110541 b: refs/heads/master c: cced02f h: refs/heads/master i: 110539: eb79d44 v: v3
1 parent 18df618 commit cd82bb0

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 5367c32c7ddb873babec89f739a936409d45476a
2+
refs/heads/master: cced02fcacfe4a6d1598e987003e00aa65713efb
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: e263ef1df7b892ed29e53313565eb05ab75e52f4
55
refs/heads/try: 597a645456b55e1c886ce15d23a192abdf4d55cf

trunk/src/librustc/metadata/loader.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -317,15 +317,23 @@ impl<'a> Context<'a> {
317317
// read the metadata from it if `*slot` is `None`. If the metadata couldn't
318318
// be read, it is assumed that the file isn't a valid rust library (no
319319
// errors are emitted).
320-
//
321-
// FIXME(#10786): for an optimization, we only read one of the library's
322-
// metadata sections. In theory we should read both, but
323-
// reading dylib metadata is quite slow.
324320
fn extract_one(&mut self, m: HashSet<Path>, flavor: &str,
325321
slot: &mut Option<MetadataBlob>) -> Option<Path> {
326322
let mut ret = None::<Path>;
327323
let mut error = 0;
328324

325+
if slot.is_some() {
326+
// FIXME(#10786): for an optimization, we only read one of the
327+
// library's metadata sections. In theory we should
328+
// read both, but reading dylib metadata is quite
329+
// slow.
330+
if m.len() == 0 {
331+
return None
332+
} else if m.len() == 1 {
333+
return Some(m.move_iter().next().unwrap())
334+
}
335+
}
336+
329337
for lib in m.move_iter() {
330338
info!("{} reading metadata from: {}", flavor, lib.display());
331339
let metadata = match get_metadata_section(self.os, &lib) {

0 commit comments

Comments
 (0)