diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2024-04-12 17:01:46 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2024-04-12 17:28:00 +0300 |
| commit | ed62b57c86a7d2985a4eae817bbce807f1ca957e (patch) | |
| tree | de7a480c7f36e1347658c1d32c71949c577d0fa1 /compiler/rustc_metadata/src | |
| parent | 7bdae134cba57426d3c56b5de737a351762445e1 (diff) | |
| download | rust-ed62b57c86a7d2985a4eae817bbce807f1ca957e.tar.gz rust-ed62b57c86a7d2985a4eae817bbce807f1ca957e.zip | |
linker: Remove laziness and caching from native search directory walks
It shouldn't be necessary for performance now.
Diffstat (limited to 'compiler/rustc_metadata/src')
| -rw-r--r-- | compiler/rustc_metadata/src/native_libs.rs | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/compiler/rustc_metadata/src/native_libs.rs b/compiler/rustc_metadata/src/native_libs.rs index c43b730eccf..58760be921a 100644 --- a/compiler/rustc_metadata/src/native_libs.rs +++ b/compiler/rustc_metadata/src/native_libs.rs @@ -17,14 +17,9 @@ use rustc_target::spec::abi::Abi; use crate::errors; -use std::path::{Path, PathBuf}; - -pub fn find_native_static_library<'a>( - name: &str, - verbatim: bool, - search_paths: impl Iterator<Item = &'a Path>, - sess: &Session, -) -> PathBuf { +use std::path::PathBuf; + +pub fn find_native_static_library(name: &str, verbatim: bool, sess: &Session) -> PathBuf { let formats = if verbatim { vec![("".into(), "".into())] } else { @@ -35,9 +30,9 @@ pub fn find_native_static_library<'a>( if os == unix { vec![os] } else { vec![os, unix] } }; - for path in search_paths { + for path in sess.target_filesearch(PathKind::Native).search_paths() { for (prefix, suffix) in &formats { - let test = path.join(format!("{prefix}{name}{suffix}")); + let test = path.dir.join(format!("{prefix}{name}{suffix}")); if test.exists() { return test; } @@ -60,8 +55,7 @@ fn find_bundled_library( && (sess.opts.unstable_opts.packed_bundled_libs || has_cfg || whole_archive == Some(true)) { let verbatim = verbatim.unwrap_or(false); - let search_paths = sess.target_filesearch(PathKind::Native).search_path_dirs(); - return find_native_static_library(name.as_str(), verbatim, search_paths, sess) + return find_native_static_library(name.as_str(), verbatim, sess) .file_name() .and_then(|s| s.to_str()) .map(Symbol::intern); |
