提交 529b19f3 编写于 作者: B bors

auto merge of #13903 : alexcrichton/rust/issue-13890, r=thestinger

The logic of the custom realpath function in metadata::loader was incorrect, but
the logic in util::fs was correct.

Closes #13890
......@@ -22,6 +22,7 @@
use syntax::diagnostic::SpanHandler;
use syntax::crateid::CrateId;
use syntax::attr::AttrMetaMethods;
use util::fs;
use std::c_str::ToCStr;
use std::cast;
......@@ -107,18 +108,6 @@ fn paths(&self) -> Vec<Path> {
}
}
// FIXME(#11857) this should be a "real" realpath
fn realpath(p: &Path) -> Path {
use std::os;
use std::io::fs;
let path = os::make_absolute(p);
match fs::readlink(&path) {
Ok(p) => p,
Err(..) => path
}
}
impl<'a> Context<'a> {
pub fn maybe_load_library_crate(&mut self) -> Option<Library> {
self.find_library_crate()
......@@ -209,7 +198,6 @@ fn find_library_crate(&mut self) -> Option<Library> {
None => return FileDoesntMatch,
Some(file) => file,
};
info!("file: {}", file);
if file.starts_with(rlib_prefix) && file.ends_with(".rlib") {
info!("rlib candidate: {}", path.display());
match self.try_match(file, rlib_prefix, ".rlib") {
......@@ -219,7 +207,7 @@ fn find_library_crate(&mut self) -> Option<Library> {
(HashSet::new(), HashSet::new())
});
let (ref mut rlibs, _) = *slot;
rlibs.insert(realpath(path));
rlibs.insert(fs::realpath(path).unwrap());
FileMatches
}
None => {
......@@ -236,7 +224,7 @@ fn find_library_crate(&mut self) -> Option<Library> {
(HashSet::new(), HashSet::new())
});
let (_, ref mut dylibs) = *slot;
dylibs.insert(realpath(path));
dylibs.insert(fs::realpath(path).unwrap());
FileMatches
}
None => {
......
-include ../tools.mk
ifdef IS_WINDOWS
all:
else
NAME := $(shell $(RUSTC) --crate-file-name foo.rs)
all:
mkdir -p $(TMPDIR)/outdir
$(RUSTC) foo.rs -o $(TMPDIR)/outdir/$(NAME)
ln -nsf outdir/$(NAME) $(TMPDIR)
RUST_LOG=rustc::metadata::loader $(RUSTC) bar.rs
endif
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
extern crate foo;
fn main() {}
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![crate_type = "rlib"]
#![crate_id = "foo"]
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册