aboutsummaryrefslogtreecommitdiff
path: root/src/comp
diff options
context:
space:
mode:
authorPatrick Walton <[email protected]>2011-05-06 18:19:42 -0700
committerPatrick Walton <[email protected]>2011-05-06 18:19:42 -0700
commita71fda40b865e23f0d191174f4584298534f2f75 (patch)
treedf4daa109770376646924c43f1d537e3b5fafbfc /src/comp
parentrustllvm: Add a function to add the standard function passes to a module; cha... (diff)
downloadrust-a71fda40b865e23f0d191174f4584298534f2f75.tar.xz
rust-a71fda40b865e23f0d191174f4584298534f2f75.zip
rustc: Make llvm_err() conform to Postel's law a little better
Diffstat (limited to 'src/comp')
-rw-r--r--src/comp/back/Link.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/comp/back/Link.rs b/src/comp/back/Link.rs
index 695d3202..89ed0d37 100644
--- a/src/comp/back/Link.rs
+++ b/src/comp/back/Link.rs
@@ -19,7 +19,12 @@ tag output_type {
}
fn llvm_err(session.session sess, str msg) {
- sess.err(msg + ": " + Str.str_from_cstr(llvm.LLVMRustGetLastError()));
+ auto buf = llvm.LLVMRustGetLastError();
+ if ((buf as uint) == 0u) {
+ sess.err(msg);
+ } else {
+ sess.err(msg + ": " + Str.str_from_cstr(buf));
+ }
fail;
}