Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added missing values in std::io::standard_error() #13799

Closed
wants to merge 1 commit into from

Conversation

m-r-r
Copy link
Contributor

@m-r-r m-r-r commented Apr 27, 2014

Hello,

With the latest version of Rust, calling to the function std::io::standard_error() 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:

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.

bors added a commit that referenced this pull request Apr 27, 2014
…crichton

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.
@bors bors closed this Apr 28, 2014
arcnmx pushed a commit to arcnmx/rust that referenced this pull request Jan 9, 2023
Rename `checkOnSave` settings to `check`

Now that flychecks can be triggered without saving the setting name doesn't make that much sense anymore. This PR renames it to just `check`, but keeps `checkOnSave` as the enabling setting.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants