1
+ #![ allow( nonstandard_style) ]
2
+ #![ allow( unsafe_op_in_unsafe_fn) ]
1
3
// miri has some special hacks here that make things unused.
2
4
#![ cfg_attr( miri, allow( unused) ) ]
3
5
@@ -79,13 +81,13 @@ use crate::path::{Path, PathBuf};
79
81
use crate :: sync:: Arc ;
80
82
use crate :: sys:: common:: small_c_string:: run_path_with_cstr;
81
83
use crate :: sys:: fd:: FileDesc ;
84
+ pub use crate :: sys:: fs:: common:: exists;
82
85
use crate :: sys:: time:: SystemTime ;
83
86
#[ cfg( all( target_os = "linux" , target_env = "gnu" ) ) ]
84
87
use crate :: sys:: weak:: syscall;
85
88
#[ cfg( target_os = "android" ) ]
86
89
use crate :: sys:: weak:: weak;
87
90
use crate :: sys:: { cvt, cvt_r} ;
88
- pub use crate :: sys_common:: fs:: exists;
89
91
use crate :: sys_common:: { AsInner , AsInnerMut , FromInner , IntoInner } ;
90
92
use crate :: { mem, ptr} ;
91
93
@@ -699,6 +701,8 @@ impl Iterator for ReadDir {
699
701
target_os = "hurd" ,
700
702
) ) ]
701
703
fn next ( & mut self ) -> Option < io:: Result < DirEntry > > {
704
+ use crate :: sys:: os:: { errno, set_errno} ;
705
+
702
706
if self . end_of_stream {
703
707
return None ;
704
708
}
@@ -710,7 +714,7 @@ impl Iterator for ReadDir {
710
714
// with unlimited or variable NAME_MAX. Many modern platforms guarantee
711
715
// thread safety for readdir() as long an individual DIR* is not accessed
712
716
// concurrently, which is sufficient for Rust.
713
- super :: os :: set_errno ( 0 ) ;
717
+ set_errno ( 0 ) ;
714
718
let entry_ptr: * const dirent64 = readdir64 ( self . inner . dirp . 0 ) ;
715
719
if entry_ptr. is_null ( ) {
716
720
// We either encountered an error, or reached the end. Either way,
@@ -719,7 +723,7 @@ impl Iterator for ReadDir {
719
723
720
724
// To distinguish between errors and end-of-directory, we had to clear
721
725
// errno beforehand to check for an error now.
722
- return match super :: os :: errno ( ) {
726
+ return match errno ( ) {
723
727
0 => None ,
724
728
e => Some ( Err ( Error :: from_raw_os_error ( e) ) ) ,
725
729
} ;
@@ -1932,7 +1936,7 @@ pub fn canonicalize(p: &Path) -> io::Result<PathBuf> {
1932
1936
1933
1937
fn open_from ( from : & Path ) -> io:: Result < ( crate :: fs:: File , crate :: fs:: Metadata ) > {
1934
1938
use crate :: fs:: File ;
1935
- use crate :: sys_common :: fs:: NOT_FILE_ERROR ;
1939
+ use crate :: sys :: fs:: common :: NOT_FILE_ERROR ;
1936
1940
1937
1941
let reader = File :: open ( from) ?;
1938
1942
let metadata = reader. metadata ( ) ?;
@@ -2151,7 +2155,7 @@ pub use remove_dir_impl::remove_dir_all;
2151
2155
miri
2152
2156
) ) ]
2153
2157
mod remove_dir_impl {
2154
- pub use crate :: sys_common :: fs:: remove_dir_all;
2158
+ pub use crate :: sys :: fs:: common :: remove_dir_all;
2155
2159
}
2156
2160
2157
2161
// Modern implementation using openat(), unlinkat() and fdopendir()
0 commit comments