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

New topic: Unwinding #17

Open
japaric opened this issue Aug 20, 2018 · 6 comments
Open

New topic: Unwinding #17

japaric opened this issue Aug 20, 2018 · 6 comments
Labels
help wanted Extra attention is needed

Comments

@japaric
Copy link
Member

japaric commented Aug 20, 2018

We should add a topic about implementing your own panic_unwind crate. I know this involves the "eh_personality" lang item but I have never done this myself. If someone has a working example that would be very useful!

As unwinding depends on an unstable feature this topic is not a blocker for the edition release.

@japaric japaric added the help wanted Extra attention is needed label Aug 20, 2018
@ianjfrosst
Copy link

The "Writing an OS in Rust" blog has a short example. Redox OS also has a more thorough implementation. Not sure about embedded Rust projects, though.

@jethrogb
Copy link

jethrogb commented Dec 7, 2018

On a related note: has anyone considered writing an unwinder in Rust? Now that compiler-builtins is largely finished, this seems one of the last pieces of C dependencies for many platforms.

@therealprof
Copy link
Contributor

Just curious: What's the use case for unwinding in embedded scenarios?

@japaric
Copy link
Member Author

japaric commented Feb 8, 2019

@therealprof running unit tests on the device. Even with a CTF (Custom Test Framework) that uses Result::Err to signal errors panics can still occur during any unit test (e.g. debug_assert!) and that would cause the test runner to stop (e.g. panic-halt). With catch_unwind functionality it would be possible to catch the panic, mark the unit test as failed and continue to run the unit tests.

@therealprof
Copy link
Contributor

Makes sense, thanks for the explanation.

@ryankurte
Copy link
Contributor

it's super cursed but i think it'd be useful to document the implications of unwinding across ffi boundaries for c/rust interop and supporting the piecewise approach to moving to rust.

ideally they never happen, but, when they do on a desktop the errors are incomprehensible, and i haven't been bold enough to see what happens in an embedded context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

5 participants