Skip to content

Commit e9ac01a

Browse files
committed
Get self-contained directory path via dedicated function
1 parent 5d29883 commit e9ac01a

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/librustc_codegen_ssa/back/link.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1075,7 +1075,7 @@ fn get_object_file_path(sess: &Session, name: &str) -> PathBuf {
10751075
if file_path.exists() {
10761076
return file_path;
10771077
}
1078-
let file_path = fs.get_lib_path().join("self-contained").join(name);
1078+
let file_path = fs.get_selfcontained_lib_path().join(name);
10791079
if file_path.exists() {
10801080
return file_path;
10811081
}
@@ -1475,7 +1475,7 @@ fn add_library_search_dirs(cmd: &mut dyn Linker, sess: &Session) {
14751475
let lib_path = sess.target_filesearch(PathKind::All).get_lib_path();
14761476
cmd.include_path(&fix_windows_verbatim_for_gcc(&lib_path));
14771477

1478-
let lib_path = sess.target_filesearch(PathKind::All).get_lib_path().join("self-contained");
1478+
let lib_path = sess.target_filesearch(PathKind::All).get_selfcontained_lib_path();
14791479
cmd.include_path(&fix_windows_verbatim_for_gcc(&lib_path));
14801480
}
14811481

src/librustc_session/filesearch.rs

+4
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ impl<'a> FileSearch<'a> {
4141
make_target_lib_path(self.sysroot, self.triple)
4242
}
4343

44+
pub fn get_selfcontained_lib_path(&self) -> PathBuf {
45+
self.get_lib_path().join("self-contained")
46+
}
47+
4448
pub fn search<F>(&self, mut pick: F)
4549
where
4650
F: FnMut(&SearchPathFile, PathKind) -> FileMatch,

0 commit comments

Comments
 (0)