diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2015-04-09 15:54:43 +0530 |
|---|---|---|
| committer | Manish Goregaokar <manishsmail@gmail.com> | 2015-04-10 00:24:44 +0530 |
| commit | 1a6e100f72d7479e667bef36c8f90c3264075783 (patch) | |
| tree | e8db06f642f52716dc3b2e46295c89790cc09914 /src/libstd/io | |
| parent | cdfbb11f680836d9db7f3062827c75470c5588c3 (diff) | |
| parent | 561fdec1350056d77245a17d59c7d740c95621d1 (diff) | |
| download | rust-1a6e100f72d7479e667bef36c8f90c3264075783.tar.gz rust-1a6e100f72d7479e667bef36c8f90c3264075783.zip | |
Rollup merge of #24216 - alexcrichton:stabilize-from-raw-os-error, r=aturon
This commit stabilizes the old `io::Error::from_os_error` after being renamed to use the `raw_os_error` terminology instead. This function is often useful when writing bindings to OS functions but only actually converting to an I/O error at a later point.
Diffstat (limited to 'src/libstd/io')
| -rw-r--r-- | src/libstd/io/error.rs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/libstd/io/error.rs b/src/libstd/io/error.rs index b84dcb8fb62..7428d0a8e35 100644 --- a/src/libstd/io/error.rs +++ b/src/libstd/io/error.rs @@ -163,12 +163,18 @@ impl Error { /// `Error` for the error code. #[stable(feature = "rust1", since = "1.0.0")] pub fn last_os_error() -> Error { - Error::from_os_error(sys::os::errno() as i32) + Error::from_raw_os_error(sys::os::errno() as i32) } /// Creates a new instance of an `Error` from a particular OS error code. - #[unstable(feature = "io", - reason = "unclear whether this function is necessary")] + #[stable(feature = "rust1", since = "1.0.0")] + pub fn from_raw_os_error(code: i32) -> Error { + Error { repr: Repr::Os(code) } + } + + /// Creates a new instance of an `Error` from a particular OS error code. + #[unstable(feature = "io", reason = "deprecated")] + #[deprecated(since = "1.0.0", reason = "renamed to from_raw_os_error")] pub fn from_os_error(code: i32) -> Error { Error { repr: Repr::Os(code) } } |
