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

Fixed snippet to return the proper error. #27020

Merged
merged 1 commit into from
Jul 17, 2015
Merged

Fixed snippet to return the proper error. #27020

merged 1 commit into from
Jul 17, 2015

Conversation

goyox86
Copy link
Contributor

@goyox86 goyox86 commented Jul 13, 2015

This PR fixes a snippet of code on the error handling chapter of "The Rust Programming Language".

//cc @steveklabnik

The docs state that trying to compile the snippet will yield the following error:

anon>:13:5: 20:6 error: non-exhaustive patterns: `_` not covered [E0004]

But instead the error received is:

<anon>:22:46: 22:56 error: unresolved name `NewRelease`
<anon>:22     std::io::println(descriptive_probability(NewRelease));
                                                       ^~~~~~~~~~
<anon>:22:5: 22:21 error: unresolved name `std::io::println`
<anon>:22     std::io::println(descriptive_probability(NewRelease));
              ^~~~~~~~~~~~~~~~
error: aborting due to 2 previous errors
playpen: application terminated with error code 101

After applying this PR the expected error is returned:

anon>:13:5: 20:6 error: non-exhaustive patterns: `_` not covered [E0004]
<anon>:13     match probability(&event) {
<anon>:14         1.00 => "certain",
<anon>:15         0.00 => "impossible",
<anon>:16         0.00 ... 0.25 => "very unlikely",
<anon>:17         0.25 ... 0.50 => "unlikely",
<anon>:18         0.50 ... 0.75 => "likely",
          ...
<anon>:13:5: 20:6 help: see the detailed explanation for E0004
error: aborting due to previous error

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @brson (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. The way Github handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@steveklabnik
Copy link
Member

@bors: r+ rollup

@bors
Copy link
Contributor

bors commented Jul 13, 2015

📌 Commit 2e1f75a has been approved by steveklabnik

@steveklabnik
Copy link
Member

Thanks! :)

@bors
Copy link
Contributor

bors commented Jul 14, 2015

⌛ Testing commit 2e1f75a with merge bbc2dc6...

bors added a commit that referenced this pull request Jul 14, 2015
…steveklabnik

This PR fixes a snippet of code on the error handling chapter of "The Rust Programming Language".

//cc @steveklabnik 

The docs state that trying to compile the snippet will yield the following error:

```bash
anon>:13:5: 20:6 error: non-exhaustive patterns: `_` not covered [E0004]
```

But instead the error received is:

```bash
<anon>:22:46: 22:56 error: unresolved name `NewRelease`
<anon>:22     std::io::println(descriptive_probability(NewRelease));
                                                       ^~~~~~~~~~
<anon>:22:5: 22:21 error: unresolved name `std::io::println`
<anon>:22     std::io::println(descriptive_probability(NewRelease));
              ^~~~~~~~~~~~~~~~
error: aborting due to 2 previous errors
playpen: application terminated with error code 101
```

After applying this PR the expected error is returned:

```bash
anon>:13:5: 20:6 error: non-exhaustive patterns: `_` not covered [E0004]
<anon>:13     match probability(&event) {
<anon>:14         1.00 => "certain",
<anon>:15         0.00 => "impossible",
<anon>:16         0.00 ... 0.25 => "very unlikely",
<anon>:17         0.25 ... 0.50 => "unlikely",
<anon>:18         0.50 ... 0.75 => "likely",
          ...
<anon>:13:5: 20:6 help: see the detailed explanation for E0004
error: aborting due to previous error
```
@bors
Copy link
Contributor

bors commented Jul 14, 2015

💔 Test failed - auto-linux-32-opt

@alexcrichton
Copy link
Member

@bors: retry

On Tue, Jul 14, 2015 at 4:13 AM, bors notifications@github.com wrote:

[image: 💔] Test failed - auto-linux-32-opt
http://buildbot.rust-lang.org/builders/auto-linux-32-opt/builds/5729


Reply to this email directly or view it on GitHub
#27020 (comment).

Manishearth added a commit to Manishearth/rust that referenced this pull request Jul 16, 2015
…snippet, r=steveklabnik

 This PR fixes a snippet of code on the error handling chapter of \"The Rust Programming Language\".

//cc @steveklabnik

The docs state that trying to compile the snippet will yield the following error:

```bash
anon>:13:5: 20:6 error: non-exhaustive patterns: `_` not covered [E0004]
```

But instead the error received is:

```bash
<anon>:22:46: 22:56 error: unresolved name `NewRelease`
<anon>:22     std::io::println(descriptive_probability(NewRelease));
                                                       ^~~~~~~~~~
<anon>:22:5: 22:21 error: unresolved name `std::io::println`
<anon>:22     std::io::println(descriptive_probability(NewRelease));
              ^~~~~~~~~~~~~~~~
error: aborting due to 2 previous errors
playpen: application terminated with error code 101
```

After applying this PR the expected error is returned:

```bash
anon>:13:5: 20:6 error: non-exhaustive patterns: `_` not covered [E0004]
<anon>:13     match probability(&event) {
<anon>:14         1.00 => \"certain\",
<anon>:15         0.00 => \"impossible\",
<anon>:16         0.00 ... 0.25 => \"very unlikely\",
<anon>:17         0.25 ... 0.50 => \"unlikely\",
<anon>:18         0.50 ... 0.75 => \"likely\",
          ...
<anon>:13:5: 20:6 help: see the detailed explanation for E0004
error: aborting due to previous error
```
@bors bors merged commit 2e1f75a into rust-lang:master Jul 17, 2015
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.

6 participants