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

Make Generic UnwindSafe even if its error type isn't #204

Merged
merged 1 commit into from
Aug 10, 2024

Commits on Jul 29, 2024

  1. Make Generic UnwindSafe even if its error type isn't

    `std::io::Error` does not implement `UnwindSafe` on account
    of its ability to wrap a `Box<dyn Error + Send + Sync>`. This
    infects `Generic` which in turn infects `Channel`, which is
    inconvenient because it means you can't construct a channel
     pair, pass the receiver side to a child thread, and then
    handles panics in the child.
    
    But this is silly, because the error parameter to `Generic`
    is just a phantom. We aren't really wrapping an error at all,
    let alone downcasting it to a mutable reference and mucking
    with the referent. This patch changes the `PhantomData<E>`
    to `PhantomData<AssertUnwindSafe<E>>` so that `Generic<F, E>` can
    be `UnwindSafe` as long as `F` is.
    dfoxfranke committed Jul 29, 2024
    Configuration menu
    Copy the full SHA
    ee61ade View commit details
    Browse the repository at this point in the history