about summary refs log tree commit diff
path: root/src/librustc_codegen_llvm
diff options
context:
space:
mode:
authorNicholas Nethercote <nnethercote@mozilla.com>2018-11-23 13:36:41 +1100
committerNicholas Nethercote <nnethercote@mozilla.com>2018-12-12 10:36:15 +1100
commit95a6262df18d8eb474efab273717dee25e79738e (patch)
treeb3d91f4d3ab815e5395affd38c45dde90e4d8aa2 /src/librustc_codegen_llvm
parent2bfe32cc9301d404c98d896efbabe8f04361d5bf (diff)
downloadrust-95a6262df18d8eb474efab273717dee25e79738e.tar.gz
rust-95a6262df18d8eb474efab273717dee25e79738e.zip
Replace `FileSearch::for_each_lib_search_path` with `search_paths`.
Returning an iterator leads to nicer code all around.
Diffstat (limited to 'src/librustc_codegen_llvm')
-rw-r--r--src/librustc_codegen_llvm/back/link.rs12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/librustc_codegen_llvm/back/link.rs b/src/librustc_codegen_llvm/back/link.rs
index da5ad39ad26..f1c0464f5f2 100644
--- a/src/librustc_codegen_llvm/back/link.rs
+++ b/src/librustc_codegen_llvm/back/link.rs
@@ -212,12 +212,7 @@ fn link_binary_output(sess: &Session,
 }
 
 fn archive_search_paths(sess: &Session) -> Vec<PathBuf> {
-    let mut search = Vec::new();
-    sess.target_filesearch(PathKind::Native).for_each_lib_search_path(|search_path| {
-        search.push(search_path.dir.to_path_buf());
-    });
-
-    search
+    sess.target_filesearch(PathKind::Native).search_path_dirs()
 }
 
 fn archive_config<'a>(sess: &'a Session,
@@ -1067,12 +1062,13 @@ fn link_args(cmd: &mut dyn Linker,
 fn add_local_native_libraries(cmd: &mut dyn Linker,
                               sess: &Session,
                               codegen_results: &CodegenResults) {
-    sess.target_filesearch(PathKind::All).for_each_lib_search_path(|search_path| {
+    let filesearch = sess.target_filesearch(PathKind::All);
+    for search_path in filesearch.search_paths() {
         match search_path.kind {
             PathKind::Framework => { cmd.framework_path(&search_path.dir); }
             _ => { cmd.include_path(&fix_windows_verbatim_for_gcc(&search_path.dir)); }
         }
-    });
+    }
 
     let relevant_libs = codegen_results.crate_info.used_libraries.iter().filter(|l| {
         relevant_lib(sess, l)