From e9ac01a9beeae77a15badcec094a7a4da0bebecb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Miku=C5=82a?= Date: Mon, 8 Jun 2020 12:47:56 +0200 Subject: [PATCH] Get self-contained directory path via dedicated function --- src/librustc_codegen_ssa/back/link.rs | 4 ++-- src/librustc_session/filesearch.rs | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/librustc_codegen_ssa/back/link.rs b/src/librustc_codegen_ssa/back/link.rs index c57b01dff280..1eef86f6c931 100644 --- a/src/librustc_codegen_ssa/back/link.rs +++ b/src/librustc_codegen_ssa/back/link.rs @@ -1075,7 +1075,7 @@ fn get_object_file_path(sess: &Session, name: &str) -> PathBuf { if file_path.exists() { return file_path; } - let file_path = fs.get_lib_path().join("self-contained").join(name); + let file_path = fs.get_selfcontained_lib_path().join(name); if file_path.exists() { return file_path; } @@ -1475,7 +1475,7 @@ fn add_library_search_dirs(cmd: &mut dyn Linker, sess: &Session) { let lib_path = sess.target_filesearch(PathKind::All).get_lib_path(); cmd.include_path(&fix_windows_verbatim_for_gcc(&lib_path)); - let lib_path = sess.target_filesearch(PathKind::All).get_lib_path().join("self-contained"); + let lib_path = sess.target_filesearch(PathKind::All).get_selfcontained_lib_path(); cmd.include_path(&fix_windows_verbatim_for_gcc(&lib_path)); } diff --git a/src/librustc_session/filesearch.rs b/src/librustc_session/filesearch.rs index e98746231fb3..37d7b0c7e1f7 100644 --- a/src/librustc_session/filesearch.rs +++ b/src/librustc_session/filesearch.rs @@ -41,6 +41,10 @@ impl<'a> FileSearch<'a> { make_target_lib_path(self.sysroot, self.triple) } + pub fn get_selfcontained_lib_path(&self) -> PathBuf { + self.get_lib_path().join("self-contained") + } + pub fn search(&self, mut pick: F) where F: FnMut(&SearchPathFile, PathKind) -> FileMatch,