@@ -102,6 +102,9 @@ impl MetadataExt {
102102 #[ inline]
103103 #[ allow( unused_comparisons) ] // NB: rust-lang/rust#115823 requires this here instead of on `st_dev` processing below
104104 pub ( crate ) fn from_rustix ( stat : Stat ) -> Metadata {
105+ #[ cfg( not( target_os = "wasi" ) ) ]
106+ use rustix:: fs:: StatExt ;
107+
105108 Metadata {
106109 file_type : ImplFileTypeExt :: from_raw_mode ( stat. st_mode as RawMode ) ,
107110 len : u64:: try_from ( stat. st_size ) . unwrap ( ) ,
@@ -112,12 +115,12 @@ impl MetadataExt {
112115
113116 #[ cfg( not( any( target_os = "netbsd" , target_os = "wasi" ) ) ) ]
114117 modified : system_time_from_rustix (
115- stat. st_mtime . try_into ( ) . unwrap ( ) ,
118+ stat. mtime ( ) . try_into ( ) . unwrap ( ) ,
116119 stat. st_mtime_nsec as _ ,
117120 ) ,
118121 #[ cfg( not( any( target_os = "netbsd" , target_os = "wasi" ) ) ) ]
119122 accessed : system_time_from_rustix (
120- stat. st_atime . try_into ( ) . unwrap ( ) ,
123+ stat. atime ( ) . try_into ( ) . unwrap ( ) ,
121124 stat. st_atime_nsec as _ ,
122125 ) ,
123126
@@ -191,19 +194,19 @@ impl MetadataExt {
191194 rdev : u64:: try_from ( stat. st_rdev ) . unwrap ( ) ,
192195 size : u64:: try_from ( stat. st_size ) . unwrap ( ) ,
193196 #[ cfg( not( target_os = "wasi" ) ) ]
194- atime : i64:: try_from ( stat. st_atime ) . unwrap ( ) ,
197+ atime : i64:: try_from ( stat. atime ( ) ) . unwrap ( ) ,
195198 #[ cfg( not( any( target_os = "netbsd" , target_os = "wasi" ) ) ) ]
196199 atime_nsec : stat. st_atime_nsec as _ ,
197200 #[ cfg( target_os = "netbsd" ) ]
198201 atime_nsec : stat. st_atimensec as _ ,
199202 #[ cfg( not( target_os = "wasi" ) ) ]
200- mtime : i64:: try_from ( stat. st_mtime ) . unwrap ( ) ,
203+ mtime : i64:: try_from ( stat. mtime ( ) ) . unwrap ( ) ,
201204 #[ cfg( not( any( target_os = "netbsd" , target_os = "wasi" ) ) ) ]
202205 mtime_nsec : stat. st_mtime_nsec as _ ,
203206 #[ cfg( target_os = "netbsd" ) ]
204207 mtime_nsec : stat. st_mtimensec as _ ,
205208 #[ cfg( not( target_os = "wasi" ) ) ]
206- ctime : i64:: try_from ( stat. st_ctime ) . unwrap ( ) ,
209+ ctime : i64:: try_from ( stat. ctime ( ) ) . unwrap ( ) ,
207210 #[ cfg( not( any( target_os = "netbsd" , target_os = "wasi" ) ) ) ]
208211 ctime_nsec : stat. st_ctime_nsec as _ ,
209212 #[ cfg( target_os = "netbsd" ) ]
0 commit comments