Skip to content

Commit 1edff46

Browse files
committed
Avoid redundant additions to PATH when linking
1 parent df1b5d3 commit 1edff46

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

compiler/rustc_session/src/session.rs

+2
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,8 @@ impl Session {
454454
let bin_path = filesearch::make_target_bin_path(&self.sysroot, config::host_triple());
455455
let fallback_sysroot_paths = filesearch::sysroot_candidates()
456456
.into_iter()
457+
// Ignore sysroot candidate if it was the same as the sysroot path we just used.
458+
.filter(|sysroot| *sysroot != self.sysroot)
457459
.map(|sysroot| filesearch::make_target_bin_path(&sysroot, config::host_triple()));
458460
let search_paths = std::iter::once(bin_path).chain(fallback_sysroot_paths);
459461

0 commit comments

Comments
 (0)