File tree Expand file tree Collapse file tree 5 files changed +11
-0
lines changed Expand file tree Collapse file tree 5 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -186,6 +186,11 @@ pub enum ErrorKind {
186186 /// This means that the operation can never succeed.
187187 #[ stable( feature = "unsupported_error" , since = "1.53.0" ) ]
188188 Unsupported ,
189+
190+ /// An operation could not be completed, because it failed
191+ /// to allocate enough memory.
192+ #[ stable( feature = "out_of_memory_error" , since = "1.53.0" ) ]
193+ OutOfMemory ,
189194}
190195
191196impl ErrorKind {
@@ -210,6 +215,7 @@ impl ErrorKind {
210215 ErrorKind :: Other => "other os error" ,
211216 ErrorKind :: UnexpectedEof => "unexpected end of file" ,
212217 ErrorKind :: Unsupported => "unsupported" ,
218+ ErrorKind :: OutOfMemory => "out of memory" ,
213219 }
214220 }
215221}
Original file line number Diff line number Diff line change @@ -149,6 +149,7 @@ pub fn decode_error_kind(errno: i32) -> ErrorKind {
149149 libc:: ETIMEDOUT => ErrorKind :: TimedOut ,
150150 libc:: EEXIST => ErrorKind :: AlreadyExists ,
151151 libc:: ENOSYS => ErrorKind :: Unsupported ,
152+ libc:: ENOMEM => ErrorKind :: OutOfMemory ,
152153
153154 // These two constants can have the same value on some systems,
154155 // but different values on others, so we can't use a match
Original file line number Diff line number Diff line change @@ -77,6 +77,7 @@ pub fn decode_error_kind(errno: i32) -> std_io::ErrorKind {
7777 wasi:: ERRNO_EXIST => AlreadyExists ,
7878 wasi:: ERRNO_AGAIN => WouldBlock ,
7979 wasi:: ERRNO_NOSYS => Unsupported ,
80+ wasi:: ERRNO_NOMEM => OutOfMemory ,
8081 _ => Other ,
8182 }
8283}
Original file line number Diff line number Diff line change @@ -168,6 +168,8 @@ pub const ERROR_FILE_NOT_FOUND: DWORD = 2;
168168pub const ERROR_PATH_NOT_FOUND : DWORD = 3 ;
169169pub const ERROR_ACCESS_DENIED : DWORD = 5 ;
170170pub const ERROR_INVALID_HANDLE : DWORD = 6 ;
171+ pub const ERROR_NOT_ENOUGH_MEMORY : DWORD = 8 ;
172+ pub const ERROR_OUTOFMEMORY : DWORD = 14 ;
171173pub const ERROR_NO_MORE_FILES : DWORD = 18 ;
172174pub const ERROR_HANDLE_EOF : DWORD = 38 ;
173175pub const ERROR_FILE_EXISTS : DWORD = 80 ;
Original file line number Diff line number Diff line change @@ -71,6 +71,7 @@ pub fn decode_error_kind(errno: i32) -> ErrorKind {
7171 c:: ERROR_PATH_NOT_FOUND => return ErrorKind :: NotFound ,
7272 c:: ERROR_NO_DATA => return ErrorKind :: BrokenPipe ,
7373 c:: ERROR_INVALID_PARAMETER => return ErrorKind :: InvalidInput ,
74+ c:: ERROR_NOT_ENOUGH_MEMORY | c:: ERROR_OUTOFMEMORY => return ErrorKind :: OutOfMemory ,
7475 c:: ERROR_SEM_TIMEOUT
7576 | c:: WAIT_TIMEOUT
7677 | c:: ERROR_DRIVER_CANCEL_TIMEOUT
You can’t perform that action at this time.
0 commit comments