diff options
| author | Felix Schütt <felix.schuett@maps4print.com> | 2017-12-28 20:05:33 +0100 |
|---|---|---|
| committer | Felix Schütt <felix.schuett@maps4print.com> | 2017-12-31 22:48:33 +0100 |
| commit | 3e3536c09cf593dba9c154880eed5995cbe90526 (patch) | |
| tree | 1ae2710e6944375b2e3582ae3651284eeaca7cd0 | |
| parent | 8c5941896248802d57e73a1fc9adbca5869f1fa1 (diff) | |
| download | rust-3e3536c09cf593dba9c154880eed5995cbe90526.tar.gz rust-3e3536c09cf593dba9c154880eed5995cbe90526.zip | |
Removed unnecessary output of linker options when linker is not installed
It's unnecessary to print the linker options if there is no linker installed. Currently, for libraries, the output is still printed, see #46998 for discussion
| -rw-r--r-- | src/librustc_trans/back/link.rs | 23 | ||||
| -rw-r--r-- | src/test/compile-fail/issue-10755.rs | 2 |
2 files changed, 20 insertions, 5 deletions
diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs index ec1c7e16c71..42538c5a3ad 100644 --- a/src/librustc_trans/back/link.rs +++ b/src/librustc_trans/back/link.rs @@ -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 \ diff --git a/src/test/compile-fail/issue-10755.rs b/src/test/compile-fail/issue-10755.rs index 87faff27195..57915bce456 100644 --- a/src/test/compile-fail/issue-10755.rs +++ b/src/test/compile-fail/issue-10755.rs @@ -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() { } |
