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 {
186
186
/// This means that the operation can never succeed.
187
187
#[ stable( feature = "unsupported_error" , since = "1.53.0" ) ]
188
188
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 ,
189
194
}
190
195
191
196
impl ErrorKind {
@@ -210,6 +215,7 @@ impl ErrorKind {
210
215
ErrorKind :: Other => "other os error" ,
211
216
ErrorKind :: UnexpectedEof => "unexpected end of file" ,
212
217
ErrorKind :: Unsupported => "unsupported" ,
218
+ ErrorKind :: OutOfMemory => "out of memory" ,
213
219
}
214
220
}
215
221
}
Original file line number Diff line number Diff line change @@ -149,6 +149,7 @@ pub fn decode_error_kind(errno: i32) -> ErrorKind {
149
149
libc:: ETIMEDOUT => ErrorKind :: TimedOut ,
150
150
libc:: EEXIST => ErrorKind :: AlreadyExists ,
151
151
libc:: ENOSYS => ErrorKind :: Unsupported ,
152
+ libc:: ENOMEM => ErrorKind :: OutOfMemory ,
152
153
153
154
// These two constants can have the same value on some systems,
154
155
// 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 {
77
77
wasi:: ERRNO_EXIST => AlreadyExists ,
78
78
wasi:: ERRNO_AGAIN => WouldBlock ,
79
79
wasi:: ERRNO_NOSYS => Unsupported ,
80
+ wasi:: ERRNO_NOMEM => OutOfMemory ,
80
81
_ => Other ,
81
82
}
82
83
}
Original file line number Diff line number Diff line change @@ -168,6 +168,8 @@ pub const ERROR_FILE_NOT_FOUND: DWORD = 2;
168
168
pub const ERROR_PATH_NOT_FOUND : DWORD = 3 ;
169
169
pub const ERROR_ACCESS_DENIED : DWORD = 5 ;
170
170
pub const ERROR_INVALID_HANDLE : DWORD = 6 ;
171
+ pub const ERROR_NOT_ENOUGH_MEMORY : DWORD = 8 ;
172
+ pub const ERROR_OUTOFMEMORY : DWORD = 14 ;
171
173
pub const ERROR_NO_MORE_FILES : DWORD = 18 ;
172
174
pub const ERROR_HANDLE_EOF : DWORD = 38 ;
173
175
pub 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 {
71
71
c:: ERROR_PATH_NOT_FOUND => return ErrorKind :: NotFound ,
72
72
c:: ERROR_NO_DATA => return ErrorKind :: BrokenPipe ,
73
73
c:: ERROR_INVALID_PARAMETER => return ErrorKind :: InvalidInput ,
74
+ c:: ERROR_NOT_ENOUGH_MEMORY | c:: ERROR_OUTOFMEMORY => return ErrorKind :: OutOfMemory ,
74
75
c:: ERROR_SEM_TIMEOUT
75
76
| c:: WAIT_TIMEOUT
76
77
| c:: ERROR_DRIVER_CANCEL_TIMEOUT
You can’t perform that action at this time.
0 commit comments