Skip to content

Print a slightly clearer message when failing to launch a thread #57833

New issue

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

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

Already on GitHub? # to your account

Merged
merged 1 commit into from
Jan 29, 2019

Conversation

jethrogb
Copy link
Contributor

@jethrogb jethrogb commented Jan 22, 2019

As discussed in #46345, the io::Error you get when a thread fails to launch is of type io::ErrorKind::WouldBlock. This is super uninformative when an arbitrary thread::spawn fails somewhere in your code:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 11,
kind: WouldBlock, message: "operation would block" }', src/libcore/result.rs:997:5

This PR improves the situation a little bit by using expect instead of unwrap. I don't consider this a complete fix for #46345 though.

@rust-highfive

This comment has been minimized.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 22, 2019
@jethrogb jethrogb force-pushed the jb/thread-spawn-unwrap branch from e156e9b to 2ec0e85 Compare January 22, 2019 13:25
@Centril
Copy link
Contributor

Centril commented Jan 27, 2019

r? @alexcrichton

@alexcrichton
Copy link
Member

@bors: r+ rollup

@bors
Copy link
Collaborator

bors commented Jan 28, 2019

📌 Commit 2ec0e85 has been approved by alexcrichton

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 28, 2019
Centril added a commit to Centril/rust that referenced this pull request Jan 28, 2019
…alexcrichton

Print a slightly clearer message when failing to launch a thread

As discussed in rust-lang#46345, the `io::Error` you get when a thread fails to launch is of type `io::ErrorKind::WouldBlock`. This is super uninformative when an arbitrary `thread::spawn` fails somewhere in your code:

```
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 11,
kind: WouldBlock, message: "operation would block" }', src/libcore/result.rs:997:5
```

This PR improves the situation a little bit by using `expect` instead of `unwrap`. I don't consider this a complete fix for rust-lang#46345 though.
Centril added a commit to Centril/rust that referenced this pull request Jan 28, 2019
…alexcrichton

Print a slightly clearer message when failing to launch a thread

As discussed in rust-lang#46345, the `io::Error` you get when a thread fails to launch is of type `io::ErrorKind::WouldBlock`. This is super uninformative when an arbitrary `thread::spawn` fails somewhere in your code:

```
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 11,
kind: WouldBlock, message: "operation would block" }', src/libcore/result.rs:997:5
```

This PR improves the situation a little bit by using `expect` instead of `unwrap`. I don't consider this a complete fix for rust-lang#46345 though.
bors added a commit that referenced this pull request Jan 29, 2019
Rollup of 7 pull requests

Successful merges:

 - #57045 (Kill remaining uses of mem::uninitialized in libcore, liballoc)
 - #57674 (Avoid erase_regions_ty queries if there are no regions to erase)
 - #57833 (Print a slightly clearer message when failing to launch a thread)
 - #57859 (Fix invalid background color)
 - #57904 (add typo suggestion to unknown attribute error)
 - #57915 (Pretty print `$crate` as `crate` or `crate_name` in more cases)
 - #57950 (Extend E0106, E0261)

Failed merges:

r? @ghost
@bors bors merged commit 2ec0e85 into rust-lang:master Jan 29, 2019
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants