@@ -1110,19 +1110,19 @@ fn print_native_static_libs(sess: &Session, all_native_libs: &[NativeLib]) {
11101110fn get_object_file_path ( sess : & Session , name : & str , self_contained : bool ) -> PathBuf {
11111111 let fs = sess. target_filesearch ( PathKind :: Native ) ;
11121112 let file_path = fs. get_lib_path ( ) . join ( name) ;
1113- if fs:: metadata ( & file_path) . is_ok ( ) {
1113+ if fs:: exists ( & file_path) {
11141114 return file_path;
11151115 }
11161116 // Special directory with objects used only in self-contained linkage mode
11171117 if self_contained {
11181118 let file_path = fs. get_self_contained_lib_path ( ) . join ( name) ;
1119- if fs:: metadata ( & file_path) . is_ok ( ) {
1119+ if fs:: exists ( & file_path) {
11201120 return file_path;
11211121 }
11221122 }
11231123 for search_path in fs. search_paths ( ) {
11241124 let file_path = search_path. dir . join ( name) ;
1125- if fs:: metadata ( & file_path) . is_ok ( ) {
1125+ if fs:: exists ( & file_path) {
11261126 return file_path;
11271127 }
11281128 }
@@ -1312,9 +1312,7 @@ fn detect_self_contained_mingw(sess: &Session) -> bool {
13121312 for dir in env:: split_paths ( & env:: var_os ( "PATH" ) . unwrap_or_default ( ) ) {
13131313 let full_path = dir. join ( & linker_with_extension) ;
13141314 // If linker comes from sysroot assume self-contained mode
1315- if fs:: metadata ( & full_path) . map ( |m| m. is_file ( ) ) . unwrap_or ( false )
1316- && !full_path. starts_with ( & sess. sysroot )
1317- {
1315+ if fs:: is_file ( & full_path) && !full_path. starts_with ( & sess. sysroot ) {
13181316 return false ;
13191317 }
13201318 }
@@ -2230,7 +2228,7 @@ fn get_apple_sdk_root(sdk_name: &str) -> Result<String, String> {
22302228 if sdkroot. contains ( "iPhoneOS.platform" )
22312229 || sdkroot. contains ( "iPhoneSimulator.platform" ) => { }
22322230 // Ignore `SDKROOT` if it's not a valid path.
2233- _ if !p. is_absolute ( ) || p == Path :: new ( "/" ) || fs:: metadata ( p ) . is_err ( ) => { }
2231+ _ if !p. is_absolute ( ) || p == Path :: new ( "/" ) || ! fs:: exists ( p ) => { }
22342232 _ => return Ok ( sdkroot) ,
22352233 }
22362234 }
0 commit comments