Skip to content

Commit 108ccb9

Browse files
committed
---
yaml --- r: 174202 b: refs/heads/batch c: a9decbd h: refs/heads/master v: v3
1 parent b6005ec commit 108ccb9

File tree

39 files changed

+1899
-2569
lines changed

39 files changed

+1899
-2569
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
2929
refs/heads/issue-18208-method-dispatch-2: 9e1eae4fb9b6527315b4441cf8a0f5ca911d1671
3030
refs/heads/automation-fail: 1bf06495443584539b958873e04cc2f864ab10e4
3131
refs/heads/issue-18208-method-dispatch-3-quick-reject: 2009f85b9f99dedcec4404418eda9ddba90258a2
32-
refs/heads/batch: 378fb5846d2d8dbc5ab24a5e92794c5c39d492dc
32+
refs/heads/batch: a9decbdc443f120d1ca2efb1798bfc20bad7c2d4
3333
refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
3434
refs/heads/beta: 44a287e6eb22ec3c2a687fc156813577464017f7
3535
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928

branches/batch/mk/crates.mk

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ TARGET_CRATES := libc std flate arena term \
5454
log regex graphviz core rbml alloc \
5555
unicode
5656
RUSTC_CRATES := rustc rustc_typeck rustc_borrowck rustc_resolve rustc_driver \
57-
rustc_trans rustc_back rustc_llvm
57+
rustc_trans rustc_back rustc_llvm rustc_privacy
5858
HOST_CRATES := syntax $(RUSTC_CRATES) rustdoc fmt_macros
5959
CRATES := $(TARGET_CRATES) $(HOST_CRATES)
6060
TOOLS := compiletest rustdoc rustc rustbook
@@ -68,12 +68,15 @@ DEPS_std := core libc rand alloc collections unicode \
6868
DEPS_graphviz := std
6969
DEPS_syntax := std term serialize log fmt_macros arena libc
7070
DEPS_rustc_driver := arena flate getopts graphviz libc rustc rustc_back rustc_borrowck \
71-
rustc_typeck rustc_resolve log syntax serialize rustc_llvm rustc_trans
71+
rustc_typeck rustc_resolve log syntax serialize rustc_llvm \
72+
rustc_trans rustc_privacy
73+
7274
DEPS_rustc_trans := arena flate getopts graphviz libc rustc rustc_back \
7375
log syntax serialize rustc_llvm
7476
DEPS_rustc_typeck := rustc syntax
7577
DEPS_rustc_borrowck := rustc log graphviz syntax
7678
DEPS_rustc_resolve := rustc log syntax
79+
DEPS_rustc_privacy := rustc log syntax
7780
DEPS_rustc := syntax flate arena serialize getopts rbml \
7881
log graphviz rustc_llvm rustc_back
7982
DEPS_rustc_llvm := native:rustllvm libc std
@@ -122,12 +125,13 @@ DOC_CRATES := $(filter-out rustc, \
122125
$(filter-out rustc_borrowck, \
123126
$(filter-out rustc_resolve, \
124127
$(filter-out rustc_driver, \
128+
$(filter-out rustc_privacy, \
125129
$(filter-out log, \
126130
$(filter-out regex, \
127131
$(filter-out getopts, \
128-
$(filter-out syntax, $(CRATES)))))))))))
132+
$(filter-out syntax, $(CRATES))))))))))))
129133
COMPILER_DOC_CRATES := rustc rustc_trans rustc_borrowck rustc_resolve \
130-
rustc_typeck rustc_driver syntax
134+
rustc_typeck rustc_driver syntax rustc_privacy
131135

132136
# This macro creates some simple definitions for each crate being built, just
133137
# some munging of all of the parameters above.

branches/batch/src/librustc/metadata/creader.rs

Lines changed: 26 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ fn dump_crates(cstore: &CStore) {
5858
debug!(" hash: {}", data.hash());
5959
opt_source.map(|cs| {
6060
let CrateSource { dylib, rlib, cnum: _ } = cs;
61-
dylib.map(|dl| debug!(" dylib: {}", dl.0.display()));
62-
rlib.map(|rl| debug!(" rlib: {}", rl.0.display()));
61+
dylib.map(|dl| debug!(" dylib: {}", dl.display()));
62+
rlib.map(|rl| debug!(" rlib: {}", rl.display()));
6363
});
6464
})
6565
}
@@ -305,8 +305,8 @@ impl<'a> CrateReader<'a> {
305305
}
306306
}
307307

308-
fn existing_match(&self, name: &str, hash: Option<&Svh>, kind: PathKind)
309-
-> Option<ast::CrateNum> {
308+
fn existing_match(&self, name: &str,
309+
hash: Option<&Svh>) -> Option<ast::CrateNum> {
310310
let mut ret = None;
311311
self.sess.cstore.iter_crate_data(|cnum, data| {
312312
if data.name != name { return }
@@ -317,37 +317,27 @@ impl<'a> CrateReader<'a> {
317317
None => {}
318318
}
319319

320-
// When the hash is None we're dealing with a top-level dependency
321-
// in which case we may have a specification on the command line for
322-
// this library. Even though an upstream library may have loaded
323-
// something of the same name, we have to make sure it was loaded
324-
// from the exact same location as well.
320+
// When the hash is None we're dealing with a top-level dependency in
321+
// which case we may have a specification on the command line for this
322+
// library. Even though an upstream library may have loaded something of
323+
// the same name, we have to make sure it was loaded from the exact same
324+
// location as well.
325325
//
326326
// We're also sure to compare *paths*, not actual byte slices. The
327327
// `source` stores paths which are normalized which may be different
328328
// from the strings on the command line.
329329
let source = self.sess.cstore.get_used_crate_source(cnum).unwrap();
330-
if let Some(locs) = self.sess.opts.externs.get(name) {
331-
let found = locs.iter().any(|l| {
332-
let l = fs::realpath(&Path::new(&l[])).ok();
333-
source.dylib.as_ref().map(|p| &p.0) == l.as_ref() ||
334-
source.rlib.as_ref().map(|p| &p.0) == l.as_ref()
335-
});
336-
if found {
337-
ret = Some(cnum);
330+
match self.sess.opts.externs.get(name) {
331+
Some(locs) => {
332+
let found = locs.iter().any(|l| {
333+
let l = fs::realpath(&Path::new(&l[])).ok();
334+
l == source.dylib || l == source.rlib
335+
});
336+
if found {
337+
ret = Some(cnum);
338+
}
338339
}
339-
}
340-
341-
// Alright, so we've gotten this far which means that `data` has the
342-
// right name, we don't have a hash, and we don't have a --extern
343-
// pointing for ourselves. We're still not quite yet done because we
344-
// have to make sure that this crate was found in the crate lookup
345-
// path (this is a top-level dependency) as we don't want to
346-
// implicitly load anything inside the dependency lookup path.
347-
let prev_kind = source.dylib.as_ref().or(source.rlib.as_ref())
348-
.unwrap().1;
349-
if ret.is_none() && (prev_kind == kind || prev_kind == PathKind::All) {
350-
ret = Some(cnum);
340+
None => ret = Some(cnum),
351341
}
352342
});
353343
return ret;
@@ -369,8 +359,8 @@ impl<'a> CrateReader<'a> {
369359
let crate_paths = if root.is_none() {
370360
Some(CratePaths {
371361
ident: ident.to_string(),
372-
dylib: lib.dylib.clone().map(|p| p.0),
373-
rlib: lib.rlib.clone().map(|p| p.0),
362+
dylib: lib.dylib.clone(),
363+
rlib: lib.rlib.clone(),
374364
})
375365
} else {
376366
None
@@ -410,7 +400,7 @@ impl<'a> CrateReader<'a> {
410400
kind: PathKind)
411401
-> (ast::CrateNum, Rc<cstore::crate_metadata>,
412402
cstore::CrateSource) {
413-
match self.existing_match(name, hash, kind) {
403+
match self.existing_match(name, hash) {
414404
None => {
415405
let mut load_ctxt = loader::Context {
416406
sess: self.sess,
@@ -493,8 +483,8 @@ impl<'a> CrateReader<'a> {
493483
let library = match load_ctxt.maybe_load_library_crate() {
494484
Some(l) => l,
495485
None if is_cross => {
496-
// Try loading from target crates. This will abort later if we
497-
// try to load a plugin registrar function,
486+
// Try loading from target crates. This will abort later if we try to
487+
// load a plugin registrar function,
498488
target_only = true;
499489
should_link = info.should_link;
500490

@@ -507,9 +497,7 @@ impl<'a> CrateReader<'a> {
507497
};
508498

509499
let dylib = library.dylib.clone();
510-
let register = should_link && self.existing_match(info.name.as_slice(),
511-
None,
512-
PathKind::Crate).is_none();
500+
let register = should_link && self.existing_match(info.name.as_slice(), None).is_none();
513501
let metadata = if register {
514502
// Register crate now to avoid double-reading metadata
515503
let (_, cmd, _) = self.register_crate(&None, &info.ident[],
@@ -523,7 +511,7 @@ impl<'a> CrateReader<'a> {
523511
PluginMetadata {
524512
sess: self.sess,
525513
metadata: metadata,
526-
dylib: dylib.map(|p| p.0),
514+
dylib: dylib,
527515
info: info,
528516
vi_span: span,
529517
target_only: target_only,

branches/batch/src/librustc/metadata/cstore.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ pub use self::NativeLibraryKind::*;
2020
use back::svh::Svh;
2121
use metadata::decoder;
2222
use metadata::loader;
23-
use session::search_paths::PathKind;
2423
use util::nodemap::{FnvHashMap, NodeMap};
2524

2625
use std::cell::RefCell;
@@ -66,8 +65,8 @@ pub enum NativeLibraryKind {
6665
// must be non-None.
6766
#[derive(PartialEq, Clone)]
6867
pub struct CrateSource {
69-
pub dylib: Option<(Path, PathKind)>,
70-
pub rlib: Option<(Path, PathKind)>,
68+
pub dylib: Option<Path>,
69+
pub rlib: Option<Path>,
7170
pub cnum: ast::CrateNum,
7271
}
7372

@@ -179,10 +178,10 @@ impl CStore {
179178
let mut libs = self.used_crate_sources.borrow()
180179
.iter()
181180
.map(|src| (src.cnum, match prefer {
182-
RequireDynamic => src.dylib.clone().map(|p| p.0),
183-
RequireStatic => src.rlib.clone().map(|p| p.0),
181+
RequireDynamic => src.dylib.clone(),
182+
RequireStatic => src.rlib.clone(),
184183
}))
185-
.collect::<Vec<_>>();
184+
.collect::<Vec<(ast::CrateNum, Option<Path>)>>();
186185
libs.sort_by(|&(a, _), &(b, _)| {
187186
ordering.position_elem(&a).cmp(&ordering.position_elem(&b))
188187
});

branches/batch/src/librustc/metadata/filesearch.rs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ pub struct FileSearch<'a> {
3939

4040
impl<'a> FileSearch<'a> {
4141
pub fn for_each_lib_search_path<F>(&self, mut f: F) where
42-
F: FnMut(&Path, PathKind) -> FileMatch,
42+
F: FnMut(&Path) -> FileMatch,
4343
{
4444
let mut visited_dirs = HashSet::new();
4545
let mut found = false;
4646

47-
for (path, kind) in self.search_paths.iter(self.kind) {
48-
match f(path, kind) {
47+
for path in self.search_paths.iter(self.kind) {
48+
match f(path) {
4949
FileMatches => found = true,
5050
FileDoesntMatch => ()
5151
}
@@ -56,7 +56,7 @@ impl<'a> FileSearch<'a> {
5656
let tlib_path = make_target_lib_path(self.sysroot,
5757
self.triple);
5858
if !visited_dirs.contains(tlib_path.as_vec()) {
59-
match f(&tlib_path, PathKind::All) {
59+
match f(&tlib_path) {
6060
FileMatches => found = true,
6161
FileDoesntMatch => ()
6262
}
@@ -76,7 +76,7 @@ impl<'a> FileSearch<'a> {
7676
visited_dirs.insert(tlib_path.as_vec().to_vec());
7777
// Don't keep searching the RUST_PATH if one match turns up --
7878
// if we did, we'd get a "multiple matching crates" error
79-
match f(&tlib_path, PathKind::All) {
79+
match f(&tlib_path) {
8080
FileMatches => {
8181
break;
8282
}
@@ -91,10 +91,8 @@ impl<'a> FileSearch<'a> {
9191
make_target_lib_path(self.sysroot, self.triple)
9292
}
9393

94-
pub fn search<F>(&self, mut pick: F)
95-
where F: FnMut(&Path, PathKind) -> FileMatch
96-
{
97-
self.for_each_lib_search_path(|lib_search_path, kind| {
94+
pub fn search<F>(&self, mut pick: F) where F: FnMut(&Path) -> FileMatch {
95+
self.for_each_lib_search_path(|lib_search_path| {
9896
debug!("searching {}", lib_search_path.display());
9997
match fs::readdir(lib_search_path) {
10098
Ok(files) => {
@@ -110,7 +108,7 @@ impl<'a> FileSearch<'a> {
110108
let files2 = files.iter().filter(|p| !is_rlib(p));
111109
for path in files1.chain(files2) {
112110
debug!("testing {}", path.display());
113-
let maybe_picked = pick(path, kind);
111+
let maybe_picked = pick(path);
114112
match maybe_picked {
115113
FileMatches => {
116114
debug!("picked {}", path.display());
@@ -144,7 +142,7 @@ impl<'a> FileSearch<'a> {
144142
// Returns a list of directories where target-specific dylibs might be located.
145143
pub fn get_dylib_search_paths(&self) -> Vec<Path> {
146144
let mut paths = Vec::new();
147-
self.for_each_lib_search_path(|lib_search_path, _| {
145+
self.for_each_lib_search_path(|lib_search_path| {
148146
paths.push(lib_search_path.clone());
149147
FileDoesntMatch
150148
});

0 commit comments

Comments
 (0)