Skip to content

Commit

Permalink
Avoid redundant additions to PATH when linking
Browse files Browse the repository at this point in the history
  • Loading branch information
madsmtm committed Oct 10, 2024
1 parent df1b5d3 commit 1edff46
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions compiler/rustc_session/src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,8 @@ impl Session {
let bin_path = filesearch::make_target_bin_path(&self.sysroot, config::host_triple());
let fallback_sysroot_paths = filesearch::sysroot_candidates()
.into_iter()
// Ignore sysroot candidate if it was the same as the sysroot path we just used.
.filter(|sysroot| *sysroot != self.sysroot)
.map(|sysroot| filesearch::make_target_bin_path(&sysroot, config::host_triple()));
let search_paths = std::iter::once(bin_path).chain(fallback_sysroot_paths);

Expand Down

0 comments on commit 1edff46

Please sign in to comment.