@@ -1609,7 +1609,7 @@ fn link_sanitizer_runtime(
16091609 fn find_sanitizer_runtime ( sess : & Session , filename : & str ) -> PathBuf {
16101610 let path = sess. target_tlib_path . dir . join ( filename) ;
16111611 if path. exists ( ) {
1612- sess. target_tlib_path . dir . clone ( )
1612+ sess. target_tlib_path . dir . to_path_buf ( )
16131613 } else {
16141614 filesearch:: make_target_lib_path (
16151615 & sess. opts . sysroot . default ,
@@ -1906,10 +1906,10 @@ fn get_object_file_path(sess: &Session, name: &str, self_contained: bool) -> Pat
19061906 return file_path;
19071907 }
19081908 }
1909- for search_path in sess . target_filesearch ( ) . search_paths ( PathKind :: Native ) {
1910- let file_path = search_path . dir . join ( name) ;
1911- if file_path . exists ( ) {
1912- return file_path ;
1909+
1910+ for ( _ , path ) in sess . target_filesearch ( ) . get_file_candidates ( name, "" , PathKind :: Native ) {
1911+ if path . exists ( ) {
1912+ return path ;
19131913 }
19141914 }
19151915 PathBuf :: from ( name)
@@ -3467,12 +3467,12 @@ fn add_upstream_native_libraries(
34673467fn rehome_sysroot_lib_dir ( sess : & Session , lib_dir : & Path ) -> PathBuf {
34683468 let sysroot_lib_path = & sess. target_tlib_path . dir ;
34693469 let canonical_sysroot_lib_path =
3470- { try_canonicalize ( sysroot_lib_path) . unwrap_or_else ( |_| sysroot_lib_path. clone ( ) ) } ;
3470+ { try_canonicalize ( sysroot_lib_path) . unwrap_or_else ( |_| sysroot_lib_path. to_path_buf ( ) ) } ;
34713471
34723472 let canonical_lib_dir = try_canonicalize ( lib_dir) . unwrap_or_else ( |_| lib_dir. to_path_buf ( ) ) ;
34733473 if canonical_lib_dir == canonical_sysroot_lib_path {
34743474 // This path already had `fix_windows_verbatim_for_gcc()` applied if needed.
3475- sysroot_lib_path. clone ( )
3475+ sysroot_lib_path. to_path_buf ( )
34763476 } else {
34773477 fix_windows_verbatim_for_gcc ( lib_dir)
34783478 }
0 commit comments