Skip to content

Commit a71fda4

Browse files
committed
rustc: Make llvm_err() conform to Postel's law a little better
1 parent ca1b166 commit a71fda4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/comp/back/Link.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,12 @@ tag output_type {
1919
}
2020

2121
fn llvm_err(session.session sess, str msg) {
22-
sess.err(msg + ": " + Str.str_from_cstr(llvm.LLVMRustGetLastError()));
22+
auto buf = llvm.LLVMRustGetLastError();
23+
if ((buf as uint) == 0u) {
24+
sess.err(msg);
25+
} else {
26+
sess.err(msg + ": " + Str.str_from_cstr(buf));
27+
}
2328
fail;
2429
}
2530

0 commit comments

Comments
 (0)