about summary refs log tree commit diff
path: root/compiler/rustc_interface/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-04-12 04:38:23 +0200
committerGitHub <noreply@github.com>2024-04-12 04:38:23 +0200
commit7f111834ad7219f32b7bdfb4e2fb4c41ca41c24f (patch)
treeb2a5132784bc19fe0c4d53d6ac9a09a0021c7135 /compiler/rustc_interface/src
parent3758e2ffa5f14d1cb50ff6d1436489bb3749f627 (diff)
parent4ded0b82caf33969d44b47c20afcbde4cf523424 (diff)
downloadrust-7f111834ad7219f32b7bdfb4e2fb4c41ca41c24f.tar.gz
rust-7f111834ad7219f32b7bdfb4e2fb4c41ca41c24f.zip
Rollup merge of #123827 - petrochenkov:searchdirs, r=Nadrieril
linker: Avoid some allocations in search directory iteration

This is more a cleanup than actual optimization.
Diffstat (limited to 'compiler/rustc_interface/src')
-rw-r--r--compiler/rustc_interface/src/passes.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/rustc_interface/src/passes.rs b/compiler/rustc_interface/src/passes.rs
index d04d30b3cb0..fe546d05ff2 100644
--- a/compiler/rustc_interface/src/passes.rs
+++ b/compiler/rustc_interface/src/passes.rs
@@ -170,7 +170,9 @@ fn configure_and_expand(
         let mut old_path = OsString::new();
         if cfg!(windows) {
             old_path = env::var_os("PATH").unwrap_or(old_path);
-            let mut new_path = sess.host_filesearch(PathKind::All).search_path_dirs();
+            let mut new_path = Vec::from_iter(
+                sess.host_filesearch(PathKind::All).search_path_dirs().map(|p| p.to_owned()),
+            );
             for path in env::split_paths(&old_path) {
                 if !new_path.contains(&path) {
                     new_path.push(path);