55#![ deny( unsafe_op_in_unsafe_fn) ]
66#![ allow( fuzzy_provenance_casts) ] // FIXME: this entire module systematically confuses pointers and integers
77
8- use crate :: io:: ErrorKind ;
8+ use crate :: io;
99use crate :: sync:: atomic:: { Atomic , AtomicBool , Ordering } ;
1010
1111pub mod abi;
@@ -31,24 +31,24 @@ pub unsafe fn cleanup() {}
3131
3232/// This function is used to implement functionality that simply doesn't exist.
3333/// Programs relying on this functionality will need to deal with the error.
34- pub fn unsupported < T > ( ) -> crate :: io:: Result < T > {
34+ pub fn unsupported < T > ( ) -> io:: Result < T > {
3535 Err ( unsupported_err ( ) )
3636}
3737
38- pub fn unsupported_err ( ) -> crate :: io:: Error {
39- crate :: io:: const_error!( ErrorKind :: Unsupported , "operation not supported on SGX yet" )
38+ pub fn unsupported_err ( ) -> io:: Error {
39+ io:: const_error!( io :: ErrorKind :: Unsupported , "operation not supported on SGX yet" )
4040}
4141
4242/// This function is used to implement various functions that doesn't exist,
4343/// but the lack of which might not be reason for error. If no error is
4444/// returned, the program might very well be able to function normally. This is
4545/// what happens when `SGX_INEFFECTIVE_ERROR` is set to `true`. If it is
4646/// `false`, the behavior is the same as `unsupported`.
47- pub fn sgx_ineffective < T > ( v : T ) -> crate :: io:: Result < T > {
47+ pub fn sgx_ineffective < T > ( v : T ) -> io:: Result < T > {
4848 static SGX_INEFFECTIVE_ERROR : Atomic < bool > = AtomicBool :: new ( false ) ;
4949 if SGX_INEFFECTIVE_ERROR . load ( Ordering :: Relaxed ) {
50- Err ( crate :: io:: const_error!(
51- ErrorKind :: Uncategorized ,
50+ Err ( io:: const_error!(
51+ io :: ErrorKind :: Uncategorized ,
5252 "operation can't be trusted to have any effect on SGX" ,
5353 ) )
5454 } else {
@@ -66,43 +66,43 @@ pub fn decode_error_kind(code: i32) -> ErrorKind {
6666
6767 // FIXME: not sure how to make sure all variants of Error are covered
6868 if code == Error :: NotFound as _ {
69- ErrorKind :: NotFound
69+ io :: ErrorKind :: NotFound
7070 } else if code == Error :: PermissionDenied as _ {
71- ErrorKind :: PermissionDenied
71+ io :: ErrorKind :: PermissionDenied
7272 } else if code == Error :: ConnectionRefused as _ {
73- ErrorKind :: ConnectionRefused
73+ io :: ErrorKind :: ConnectionRefused
7474 } else if code == Error :: ConnectionReset as _ {
75- ErrorKind :: ConnectionReset
75+ io :: ErrorKind :: ConnectionReset
7676 } else if code == Error :: ConnectionAborted as _ {
77- ErrorKind :: ConnectionAborted
77+ io :: ErrorKind :: ConnectionAborted
7878 } else if code == Error :: NotConnected as _ {
79- ErrorKind :: NotConnected
79+ io :: ErrorKind :: NotConnected
8080 } else if code == Error :: AddrInUse as _ {
81- ErrorKind :: AddrInUse
81+ io :: ErrorKind :: AddrInUse
8282 } else if code == Error :: AddrNotAvailable as _ {
83- ErrorKind :: AddrNotAvailable
83+ io :: ErrorKind :: AddrNotAvailable
8484 } else if code == Error :: BrokenPipe as _ {
85- ErrorKind :: BrokenPipe
85+ io :: ErrorKind :: BrokenPipe
8686 } else if code == Error :: AlreadyExists as _ {
87- ErrorKind :: AlreadyExists
87+ io :: ErrorKind :: AlreadyExists
8888 } else if code == Error :: WouldBlock as _ {
89- ErrorKind :: WouldBlock
89+ io :: ErrorKind :: WouldBlock
9090 } else if code == Error :: InvalidInput as _ {
91- ErrorKind :: InvalidInput
91+ io :: ErrorKind :: InvalidInput
9292 } else if code == Error :: InvalidData as _ {
93- ErrorKind :: InvalidData
93+ io :: ErrorKind :: InvalidData
9494 } else if code == Error :: TimedOut as _ {
95- ErrorKind :: TimedOut
95+ io :: ErrorKind :: TimedOut
9696 } else if code == Error :: WriteZero as _ {
97- ErrorKind :: WriteZero
97+ io :: ErrorKind :: WriteZero
9898 } else if code == Error :: Interrupted as _ {
99- ErrorKind :: Interrupted
99+ io :: ErrorKind :: Interrupted
100100 } else if code == Error :: Other as _ {
101- ErrorKind :: Uncategorized
101+ io :: ErrorKind :: Uncategorized
102102 } else if code == Error :: UnexpectedEof as _ {
103- ErrorKind :: UnexpectedEof
103+ io :: ErrorKind :: UnexpectedEof
104104 } else {
105- ErrorKind :: Uncategorized
105+ io :: ErrorKind :: Uncategorized
106106 }
107107}
108108
0 commit comments