about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-07-24 16:11:23 +0000
committerbors <bors@rust-lang.org>2014-07-24 16:11:23 +0000
commit4461f03a36a7a2d0ce2d6e3b50c92a7d75ccb40d (patch)
treecf2ce47db686efea410691f337bba732cf821e64 /src/rustllvm/RustWrapper.cpp
parent6203f8ac7b2c31611ef7b84a940dba56058ac03d (diff)
parent1031ad8f709839a4d34045c6b116704e639f5cbe (diff)
downloadrust-4461f03a36a7a2d0ce2d6e3b50c92a7d75ccb40d.tar.gz
rust-4461f03a36a7a2d0ce2d6e3b50c92a7d75ccb40d.zip
auto merge of #15949 : alexcrichton/rust/rollup, r=alexcrichton
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
-rw-r--r--src/rustllvm/RustWrapper.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/rustllvm/RustWrapper.cpp b/src/rustllvm/RustWrapper.cpp
index a1a88d1b14d..a4437ea7c7b 100644
--- a/src/rustllvm/RustWrapper.cpp
+++ b/src/rustllvm/RustWrapper.cpp
@@ -658,13 +658,14 @@ LLVMRustLinkInExternalBitcode(LLVMModuleRef dst, char *bc, size_t len) {
 #if LLVM_VERSION_MINOR >= 5
 extern "C" void*
 LLVMRustOpenArchive(char *path) {
-    std::unique_ptr<MemoryBuffer> buf;
-    std::error_code err = MemoryBuffer::getFile(path, buf);
-    if (err) {
-        LLVMRustSetLastError(err.message().c_str());
+    ErrorOr<std::unique_ptr<MemoryBuffer>> buf_or = MemoryBuffer::getFile(path);
+    if (!buf_or) {
+        LLVMRustSetLastError(buf_or.getError().message().c_str());
         return NULL;
     }
-    Archive *ret = new Archive(buf.release(), err);
+
+    std::error_code err;
+    Archive *ret = new Archive(std::move(buf_or.get()), err);
     if (err) {
         LLVMRustSetLastError(err.message().c_str());
         return NULL;