Changed addl_lib_search_paths from HashSet to Vec
This makes the extra library paths given to the gcc linker come in the same order as the -L options on the rustc command line.
This commit is contained in:
parent
57781c3c30
commit
61414a9850
@ -28,7 +28,6 @@ use util::ppaux;
|
|||||||
use util::sha2::{Digest, Sha256};
|
use util::sha2::{Digest, Sha256};
|
||||||
|
|
||||||
use std::char;
|
use std::char;
|
||||||
use std::collections::HashSet;
|
|
||||||
use std::io::{fs, TempDir, Command};
|
use std::io::{fs, TempDir, Command};
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
@ -570,10 +569,7 @@ fn link_binary_output(sess: &Session,
|
|||||||
fn archive_search_paths(sess: &Session) -> Vec<Path> {
|
fn archive_search_paths(sess: &Session) -> Vec<Path> {
|
||||||
let mut rustpath = filesearch::rust_path();
|
let mut rustpath = filesearch::rust_path();
|
||||||
rustpath.push(sess.target_filesearch().get_lib_path());
|
rustpath.push(sess.target_filesearch().get_lib_path());
|
||||||
// FIXME: Addl lib search paths are an unordered HashSet?
|
let mut search: Vec<Path> = sess.opts.addl_lib_search_paths.borrow().clone();
|
||||||
// Shouldn't this search be done in some order?
|
|
||||||
let addl_lib_paths: HashSet<Path> = sess.opts.addl_lib_search_paths.borrow().clone();
|
|
||||||
let mut search: Vec<Path> = addl_lib_paths.move_iter().collect();
|
|
||||||
search.push_all(rustpath.as_slice());
|
search.push_all(rustpath.as_slice());
|
||||||
return search;
|
return search;
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ use syntax::diagnostic::{ColorConfig, Auto, Always, Never};
|
|||||||
use syntax::parse;
|
use syntax::parse;
|
||||||
use syntax::parse::token::InternedString;
|
use syntax::parse::token::InternedString;
|
||||||
|
|
||||||
use std::collections::{HashSet, HashMap};
|
use std::collections::HashMap;
|
||||||
use getopts::{optopt, optmulti, optflag, optflagopt};
|
use getopts::{optopt, optmulti, optflag, optflagopt};
|
||||||
use getopts;
|
use getopts;
|
||||||
use std::cell::{RefCell};
|
use std::cell::{RefCell};
|
||||||
@ -76,7 +76,7 @@ pub struct Options {
|
|||||||
// This was mutable for rustpkg, which updates search paths based on the
|
// This was mutable for rustpkg, which updates search paths based on the
|
||||||
// parsed code. It remains mutable in case its replacements wants to use
|
// parsed code. It remains mutable in case its replacements wants to use
|
||||||
// this.
|
// this.
|
||||||
pub addl_lib_search_paths: RefCell<HashSet<Path>>,
|
pub addl_lib_search_paths: RefCell<Vec<Path>>,
|
||||||
pub maybe_sysroot: Option<Path>,
|
pub maybe_sysroot: Option<Path>,
|
||||||
pub target_triple: String,
|
pub target_triple: String,
|
||||||
// User-specified cfg meta items. The compiler itself will add additional
|
// User-specified cfg meta items. The compiler itself will add additional
|
||||||
@ -113,7 +113,7 @@ pub fn basic_options() -> Options {
|
|||||||
lint_opts: Vec::new(),
|
lint_opts: Vec::new(),
|
||||||
describe_lints: false,
|
describe_lints: false,
|
||||||
output_types: Vec::new(),
|
output_types: Vec::new(),
|
||||||
addl_lib_search_paths: RefCell::new(HashSet::new()),
|
addl_lib_search_paths: RefCell::new(Vec::new()),
|
||||||
maybe_sysroot: None,
|
maybe_sysroot: None,
|
||||||
target_triple: driver::host_triple().to_string(),
|
target_triple: driver::host_triple().to_string(),
|
||||||
cfg: Vec::new(),
|
cfg: Vec::new(),
|
||||||
|
@ -30,7 +30,7 @@ pub type pick<'a> = |path: &Path|: 'a -> FileMatch;
|
|||||||
|
|
||||||
pub struct FileSearch<'a> {
|
pub struct FileSearch<'a> {
|
||||||
pub sysroot: &'a Path,
|
pub sysroot: &'a Path,
|
||||||
pub addl_lib_search_paths: &'a RefCell<HashSet<Path>>,
|
pub addl_lib_search_paths: &'a RefCell<Vec<Path>>,
|
||||||
pub triple: &'a str,
|
pub triple: &'a str,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,7 +125,7 @@ impl<'a> FileSearch<'a> {
|
|||||||
|
|
||||||
pub fn new(sysroot: &'a Path,
|
pub fn new(sysroot: &'a Path,
|
||||||
triple: &'a str,
|
triple: &'a str,
|
||||||
addl_lib_search_paths: &'a RefCell<HashSet<Path>>) -> FileSearch<'a> {
|
addl_lib_search_paths: &'a RefCell<Vec<Path>>) -> FileSearch<'a> {
|
||||||
debug!("using sysroot = {}, triple = {}", sysroot.display(), triple);
|
debug!("using sysroot = {}, triple = {}", sysroot.display(), triple);
|
||||||
FileSearch {
|
FileSearch {
|
||||||
sysroot: sysroot,
|
sysroot: sysroot,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
|
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
|
||||||
// file at the top-level directory of this distribution and at
|
// file at the top-level directory of this distribution and at
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
// http://rust-lang.org/COPYRIGHT.
|
||||||
//
|
//
|
||||||
@ -80,7 +80,7 @@ pub struct CrateAnalysis {
|
|||||||
pub type Externs = HashMap<String, Vec<String>>;
|
pub type Externs = HashMap<String, Vec<String>>;
|
||||||
|
|
||||||
/// Parses, resolves, and typechecks the given crate
|
/// Parses, resolves, and typechecks the given crate
|
||||||
fn get_ast_and_resolve(cpath: &Path, libs: HashSet<Path>, cfgs: Vec<String>,
|
fn get_ast_and_resolve(cpath: &Path, libs: Vec<Path>, cfgs: Vec<String>,
|
||||||
externs: Externs, triple: Option<String>)
|
externs: Externs, triple: Option<String>)
|
||||||
-> (DocContext, CrateAnalysis) {
|
-> (DocContext, CrateAnalysis) {
|
||||||
use syntax::codemap::dummy_spanned;
|
use syntax::codemap::dummy_spanned;
|
||||||
@ -153,7 +153,7 @@ fn get_ast_and_resolve(cpath: &Path, libs: HashSet<Path>, cfgs: Vec<String>,
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn run_core(libs: HashSet<Path>, cfgs: Vec<String>, externs: Externs,
|
pub fn run_core(libs: Vec<Path>, cfgs: Vec<String>, externs: Externs,
|
||||||
path: &Path, triple: Option<String>)
|
path: &Path, triple: Option<String>)
|
||||||
-> (clean::Crate, CrateAnalysis) {
|
-> (clean::Crate, CrateAnalysis) {
|
||||||
let (ctxt, analysis) = get_ast_and_resolve(path, libs, cfgs, externs, triple);
|
let (ctxt, analysis) = get_ast_and_resolve(path, libs, cfgs, externs, triple);
|
||||||
|
@ -369,11 +369,7 @@ fn rust_input(cratefile: &str, externs: core::Externs, matches: &getopts::Matche
|
|||||||
info!("starting to run rustc");
|
info!("starting to run rustc");
|
||||||
let (mut krate, analysis) = std::task::try(proc() {
|
let (mut krate, analysis) = std::task::try(proc() {
|
||||||
let cr = cr;
|
let cr = cr;
|
||||||
core::run_core(libs.move_iter().collect(),
|
core::run_core(libs, cfgs, externs, &cr, triple)
|
||||||
cfgs,
|
|
||||||
externs,
|
|
||||||
&cr,
|
|
||||||
triple)
|
|
||||||
}).map_err(|boxed_any|format!("{:?}", boxed_any)).unwrap();
|
}).map_err(|boxed_any|format!("{:?}", boxed_any)).unwrap();
|
||||||
info!("finished with rustc");
|
info!("finished with rustc");
|
||||||
analysiskey.replace(Some(analysis));
|
analysiskey.replace(Some(analysis));
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
use std::collections::HashSet;
|
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::string::String;
|
use std::string::String;
|
||||||
|
|
||||||
@ -136,7 +135,7 @@ pub fn render(input: &str, mut output: Path, matches: &getopts::Matches,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Run any tests/code examples in the markdown file `input`.
|
/// Run any tests/code examples in the markdown file `input`.
|
||||||
pub fn test(input: &str, libs: HashSet<Path>, externs: core::Externs,
|
pub fn test(input: &str, libs: Vec<Path>, externs: core::Externs,
|
||||||
mut test_args: Vec<String>) -> int {
|
mut test_args: Vec<String>) -> int {
|
||||||
let input_str = load_or_return!(input, 1, 2);
|
let input_str = load_or_return!(input, 1, 2);
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ use visit_ast::RustdocVisitor;
|
|||||||
|
|
||||||
pub fn run(input: &str,
|
pub fn run(input: &str,
|
||||||
cfgs: Vec<String>,
|
cfgs: Vec<String>,
|
||||||
libs: HashSet<Path>,
|
libs: Vec<Path>,
|
||||||
externs: core::Externs,
|
externs: core::Externs,
|
||||||
mut test_args: Vec<String>,
|
mut test_args: Vec<String>,
|
||||||
crate_name: Option<String>)
|
crate_name: Option<String>)
|
||||||
@ -109,7 +109,7 @@ pub fn run(input: &str,
|
|||||||
0
|
0
|
||||||
}
|
}
|
||||||
|
|
||||||
fn runtest(test: &str, cratename: &str, libs: HashSet<Path>, externs: core::Externs,
|
fn runtest(test: &str, cratename: &str, libs: Vec<Path>, externs: core::Externs,
|
||||||
should_fail: bool, no_run: bool, as_test_harness: bool) {
|
should_fail: bool, no_run: bool, as_test_harness: bool) {
|
||||||
// the test harness wants its own `main` & top level functions, so
|
// the test harness wants its own `main` & top level functions, so
|
||||||
// never wrap the test in `fn main() { ... }`
|
// never wrap the test in `fn main() { ... }`
|
||||||
@ -244,7 +244,7 @@ pub fn maketest(s: &str, cratename: Option<&str>, lints: bool, dont_insert_main:
|
|||||||
pub struct Collector {
|
pub struct Collector {
|
||||||
pub tests: Vec<testing::TestDescAndFn>,
|
pub tests: Vec<testing::TestDescAndFn>,
|
||||||
names: Vec<String>,
|
names: Vec<String>,
|
||||||
libs: HashSet<Path>,
|
libs: Vec<Path>,
|
||||||
externs: core::Externs,
|
externs: core::Externs,
|
||||||
cnt: uint,
|
cnt: uint,
|
||||||
use_headers: bool,
|
use_headers: bool,
|
||||||
@ -253,7 +253,7 @@ pub struct Collector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Collector {
|
impl Collector {
|
||||||
pub fn new(cratename: String, libs: HashSet<Path>, externs: core::Externs,
|
pub fn new(cratename: String, libs: Vec<Path>, externs: core::Externs,
|
||||||
use_headers: bool) -> Collector {
|
use_headers: bool) -> Collector {
|
||||||
Collector {
|
Collector {
|
||||||
tests: Vec::new(),
|
tests: Vec::new(),
|
||||||
|
Loading…
Reference in New Issue
Block a user