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

C-unwind and Rust 1.71.0 #539

Open
herabit opened this issue Dec 10, 2023 · 7 comments
Open

C-unwind and Rust 1.71.0 #539

herabit opened this issue Dec 10, 2023 · 7 comments
Labels
A-block2 Affects the `block2` crate A-objc2 Affects the `objc2`, `objc-sys` and/or `objc2-encode` crates bug Something isn't working I-unsound A soundness hole
Milestone

Comments

@herabit
Copy link

herabit commented Dec 10, 2023

Rust 1.71.0 stabilizes (at least partially) C-unwinding. However, due to issues with the feature attribute's usage on stable, one is unable to utilize C-unwind on Rust 1.71.0+, despite it being available, when on stable.

There should be some kind of additional conditional compilation code to handle these versions, while still maintaining the current MSRV of 0.60.0. I'm trying to figure out how myself rn, hence my fork.

@madsmtm madsmtm added A-objc2 Affects the `objc2`, `objc-sys` and/or `objc2-encode` crates A-block2 Affects the `block2` crate I-unsound A soundness hole bug Something isn't working and removed I-unsound A soundness hole labels Dec 10, 2023
@madsmtm
Copy link
Owner

madsmtm commented Dec 10, 2023

If we just remove the #![feature(c_unwind)], then it should compile on stable, no?

@madsmtm madsmtm added the I-unsound A soundness hole label Dec 10, 2023
@madsmtm
Copy link
Owner

madsmtm commented Dec 10, 2023

Though actually making extern "C-unwind" sound will take more effort, since Rust panics and Objective-C exceptions are not compatible.

@herabit
Copy link
Author

herabit commented Dec 10, 2023

Yeah this is kind of annoying when I'm trying to make Rust cocoa wrappers that, are Rusty, and, safe. I wonder if there's any way to bridge this incompatibility...

@madsmtm
Copy link
Owner

madsmtm commented Mar 14, 2024

Given that rust-lang/rust#115285 is FCP, this is now becoming a bit more important.

Unfortunately, I can't really raise the MSRV for objc2 to 1.71.0 yet, as Winit's MSRV is still at 1.70.0 :/

@herabit
Copy link
Author

herabit commented Mar 14, 2024

It could, at least in the short term be an opt-in feature, or perhaps enabled only on newer rust versions with a crate such as rustversion, which, well allows conditional compilation based upon whatever version of rustc you're compiling for. It may be worth taking a look at, though, in the short term it may complicate maintainability, and anger some folk due to the additional dependency. A build script may be able to provide similar functionality, though, again with potential issues pertaining to maintainability, as managing a lot of conditional compilation can, really be a pain in the ass.

@madsmtm
Copy link
Owner

madsmtm commented Mar 14, 2024

Yeah. I think the easier solution might be to allow a bump to Winit's Rust version on macOS only.

@madsmtm madsmtm added this to the objc2 v0.6 milestone May 20, 2024
madsmtm added a commit that referenced this issue Jun 2, 2024
Improves the situation in #539.
madsmtm added a commit that referenced this issue Jun 2, 2024
Improves the situation in #539.
@madsmtm
Copy link
Owner

madsmtm commented Jun 2, 2024

In bbf81ac and fc7e6e2 I've improved upon this by making the (still unstable) feature available in block2, and by removing #![feature(c_unwind)].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-block2 Affects the `block2` crate A-objc2 Affects the `objc2`, `objc-sys` and/or `objc2-encode` crates bug Something isn't working I-unsound A soundness hole
Projects
None yet
Development

No branches or pull requests

2 participants