Skip to content
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
14 changes: 12 additions & 2 deletions src/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 19 additions & 4 deletions src/librustc_trans/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -708,10 +708,25 @@ fn link_natively(sess: &Session,
info!("linker stdout:\n{}", escape_string(&prog.stdout));
},
Err(e) => {
sess.struct_err(&format!("could not exec the linker `{}`: {}", pname.display(), e))
.note(&format!("{:?}", &cmd))
.emit();
if sess.target.target.options.is_like_msvc && e.kind() == io::ErrorKind::NotFound {
let linker_not_found = e.kind() == io::ErrorKind::NotFound;

let mut linker_error = {
if linker_not_found {
sess.struct_err(&format!("linker `{}` not found", pname.display()))
} else {
sess.struct_err(&format!("could not exec the linker `{}`", pname.display()))
}
};

linker_error.note(&format!("{}", e));

if !linker_not_found {
linker_error.note(&format!("{:?}", &cmd));
}

linker_error.emit();

if sess.target.target.options.is_like_msvc && linker_not_found {
sess.note_without_error("the msvc targets depend on the msvc linker \
but `link.exe` was not found");
sess.note_without_error("please ensure that VS 2013 or VS 2015 was installed \
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-10755.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// except according to those terms.

// compile-flags: -C linker=llllll -Z linker-flavor=ld
// error-pattern: the linker `llllll`
// error-pattern: linker `llllll` not found

fn main() {
}