]> git.proxmox.com Git - rustc.git/blobdiff - src/librustc_llvm/archive_ro.rs
Imported Upstream version 1.8.0+dfsg1
[rustc.git] / src / librustc_llvm / archive_ro.rs
index 85c0c721114f5837d6c112e9a47a74420c0087e3..be7f0ed6a0298dd8b46e80a683684f9f7f7e2998 100644 (file)
@@ -79,14 +79,14 @@ impl Drop for ArchiveRO {
 }
 
 impl<'a> Iterator for Iter<'a> {
-    type Item = Child<'a>;
+    type Item = Result<Child<'a>, String>;
 
-    fn next(&mut self) -> Option<Child<'a>> {
+    fn next(&mut self) -> Option<Result<Child<'a>, String>> {
         let ptr = unsafe { ::LLVMRustArchiveIteratorNext(self.ptr) };
         if ptr.is_null() {
-            None
+            ::last_error().map(Err)
         } else {
-            Some(Child { ptr: ptr, _data: marker::PhantomData })
+            Some(Ok(Child { ptr: ptr, _data: marker::PhantomData }))
         }
     }
 }