]> git.lizzy.rs Git - rust.git/commit
auto merge of #13799 : m-r-r/rust/patch-std-io-standard_error, r=alexcrichton
authorbors <bors@rust-lang.org>
Sun, 27 Apr 2014 23:01:39 +0000 (16:01 -0700)
committerbors <bors@rust-lang.org>
Sun, 27 Apr 2014 23:01:39 +0000 (16:01 -0700)
commit8b24964012cffda83deb7749fdddd047a4144df4
treea970d386eac88b33f399cd6a7c00129b4fcf97c3
parent479b8a812c011ee103b52cab665a3d6f02c40ddf
parenta7b8a13e143c7e9c071149648d4681095a4abe4a
auto merge of #13799 : m-r-r/rust/patch-std-io-standard_error, r=alexcrichton

Hello,

With the latest version of Rust, calling to the function [`std::io::standard_error()`](http://static.rust-lang.org/doc/master/std/io/fn.standard_error.html) succeeds only if the value of the argument is `EndOfFile`, `IoUnavailable` or `InvalidInput`. If the function is called with another value as argument, it fails without message.

Here is a piece of code that reproduces the problem:

```rust
use std::io::{standard_error,EndOfFile,FileNotFound,PermissionDenied};

fn main() {
     println!("Error 1: {}", standard_error(EndOfFile)); // does not fail
     println!("Error 2: {}", standard_error(FileNotFound)); // fails
     println!("Error 3: {}", standard_error(PermissionDenied)); //fails
}
```
This was because the `IoErrorKind` passed as argument wasn't matched against all the possible values.

I added the missing branches in the `match` statement inside the function, and i removed the call to the `fail!()` macro. I rebuilt the crate with the latest `rustc` version and it seems to works.