Skip to content

Don’t ICE if fs::canonicalise fails in meta-load #26044

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 8, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions src/librustc/metadata/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down
16 changes: 16 additions & 0 deletions src/test/run-make/issue-26006/Makefile
Original file line number Diff line number Diff line change
@@ -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/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this command expected to fail without an ICE error message? (e.g, shouldn't there be a piping or assertion of some form here?)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I understand -Ldependency= adds some path to a list of directories in which to look for library files, right? Then this fails to use symlinked libc and proceeds to find one in rustc’s own distribution, which is why this doesn’t fail.

If this specified --extern libc=, though, then it would be a different problem.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah right, I see what's going on here now, nevermind then!


libc:
mkdir -p out/libc
$(RUSTC) in/libc/lib.rs --crate-name=libc -o out/libc/liblibc.rlib
else
all:
endif
12 changes: 12 additions & 0 deletions src/test/run-make/issue-26006/in/libc/lib.rs
Original file line number Diff line number Diff line change
@@ -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 <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"]

pub fn something(){}
13 changes: 13 additions & 0 deletions src/test/run-make/issue-26006/in/time/lib.rs
Original file line number Diff line number Diff line change
@@ -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 <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.
#![feature(libc)]
extern crate libc;

fn main(){}