diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2024-04-12 00:09:43 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2024-04-12 00:41:08 +0300 |
| commit | 4ded0b82caf33969d44b47c20afcbde4cf523424 (patch) | |
| tree | 49224a320ae543af1a5e61100c6c221010567003 /compiler/rustc_interface/src | |
| parent | aa6a697a1c75b0aa06954136f7641706edadc2be (diff) | |
| download | rust-4ded0b82caf33969d44b47c20afcbde4cf523424.tar.gz rust-4ded0b82caf33969d44b47c20afcbde4cf523424.zip | |
linker: Avoid some allocations in search directory iteration
Diffstat (limited to 'compiler/rustc_interface/src')
| -rw-r--r-- | compiler/rustc_interface/src/passes.rs | 4 |
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); |
