Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

Use Result instead of panicking in case of a failed Cargo build routine - #492

Merged
nrc merged 1 commit into
rust-lang:masterfrom
Xanewok:cargo-dont-panic
Sep 22, 2017
Merged

nrc merged 1 commit into
rust-lang:masterfrom
Xanewok:cargo-dont-panic

Conversation

@Xanewok

@Xanewok Xanewok commented Sep 21, 2017 •

Copy link
Copy Markdown
Contributor

Fixes #483.

When we panic inside a different thread, while holding all the necessary
locks, we effectively poison them. This in turn, makes any subsequent
compilation runs impossible and blocks the RLS.

Instead of panicking, the Result control flow is introduced when running
Cargo build and on any encountered error we just return early and
report the error, but also releasing any acquired lock during the routine.


I only have anecdotal evidence, but just as a side note, despite the
change not being too big, with it, the RLS feels a lot more stable and it
didn't get into corrupt state for me yet.

Fixes rust-lang#483.
When we panic inside a different thread, while holding all the necessary
locks, we effectively poison them. This in turn, makes any subsequent
compilation runs impossible and blocks the RLS.
Instead of panicking, the Result control flow is introduced and on any
encountered error we just return early and report the error, still
releasing any acquired lock during the routine.
@nrc

nrc commented Sep 22, 2017

Copy link
Copy Markdown
Member

Cool, looks like pure win

@nrc
nrc merged commit 65e6eb6 into rust-lang:master Sep 22, 2017
@Xanewok
Xanewok deleted the cargo-dont-panic branch September 22, 2017 07:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

⌂ Proxy