From ab86face01786a67da3f6d15db0c3295d75dcdd6 Mon Sep 17 00:00:00 2001 From: Simonas Kazlauskas Date: Sat, 6 Jun 2015 01:13:19 +0300 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20ICE=20if=20fs::canonicalise=20f?= =?UTF-8?q?ails=20in=20meta-load?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This might fail when --extern library is a symlink to an invalid location. Instead just pretend it doesn’t exist at all. --- src/librustc/metadata/loader.rs | 15 ++++++++------- src/test/run-make/issue-26006/Makefile | 16 ++++++++++++++++ src/test/run-make/issue-26006/in/libc/lib.rs | 12 ++++++++++++ src/test/run-make/issue-26006/in/time/lib.rs | 13 +++++++++++++ 4 files changed, 49 insertions(+), 7 deletions(-) create mode 100644 src/test/run-make/issue-26006/Makefile create mode 100644 src/test/run-make/issue-26006/in/libc/lib.rs create mode 100644 src/test/run-make/issue-26006/in/time/lib.rs diff --git a/src/librustc/metadata/loader.rs b/src/librustc/metadata/loader.rs index f96094d3d09..5f1e30ae63a 100644 --- a/src/librustc/metadata/loader.rs +++ b/src/librustc/metadata/loader.rs @@ -429,13 +429,14 @@ impl<'a> Context<'a> { let slot = candidates.entry(hash_str) .or_insert_with(|| (HashMap::new(), HashMap::new())); let (ref mut rlibs, ref mut dylibs) = *slot; - if rlib { - rlibs.insert(fs::canonicalize(path).unwrap(), kind); - } else { - dylibs.insert(fs::canonicalize(path).unwrap(), kind); - } - - FileMatches + fs::canonicalize(path).map(|p| { + if rlib { + rlibs.insert(p, kind); + } else { + dylibs.insert(p, kind); + } + FileMatches + }).unwrap_or(FileDoesntMatch) }); self.rejected_via_kind.extend(staticlibs.into_iter()); diff --git a/src/test/run-make/issue-26006/Makefile b/src/test/run-make/issue-26006/Makefile new file mode 100644 index 00000000000..10c789d20c0 --- /dev/null +++ b/src/test/run-make/issue-26006/Makefile @@ -0,0 +1,16 @@ +-include ../tools.mk + +ifndef IS_WINDOWS +all: time + +time: libc + mkdir -p out/time out/time/deps + ln -sf out/libc/liblibc.rlib out/time/deps/ + $(RUSTC) in/time/lib.rs -Ldependency=out/time/deps/ + +libc: + mkdir -p out/libc + $(RUSTC) in/libc/lib.rs --crate-name=libc -o out/libc/liblibc.rlib +else +all: +endif diff --git a/src/test/run-make/issue-26006/in/libc/lib.rs b/src/test/run-make/issue-26006/in/libc/lib.rs new file mode 100644 index 00000000000..177ffdce062 --- /dev/null +++ b/src/test/run-make/issue-26006/in/libc/lib.rs @@ -0,0 +1,12 @@ +// Copyright 2015 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +#![crate_type="rlib"] + +pub fn something(){} diff --git a/src/test/run-make/issue-26006/in/time/lib.rs b/src/test/run-make/issue-26006/in/time/lib.rs new file mode 100644 index 00000000000..b1d07d57337 --- /dev/null +++ b/src/test/run-make/issue-26006/in/time/lib.rs @@ -0,0 +1,13 @@ +// Copyright 2015 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +#![feature(libc)] +extern crate libc; + +fn main(){}