-
Notifications
You must be signed in to change notification settings - Fork 221
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
Fixes so the compiler can infer msg_send! return types #340
Conversation
Currently, due to a quirk in Rust's type inference interacting with the structure of the msg_send! macro, a () return type will be inferred when the compiler cannot otherwise determine the return type. This behavior is expected to change, and in the future could resolve to a ! return type, which results in undefined behavior. Linting has previously been added for this in rust-lang/rust#39216, but it did not catch these cases due to SSheldon/rust-objc#62. An upcoming version of objc will be fixed to stop hiding these errors, at which point they will become compile errors. This change fixes these errors and allows cocoa to compile with the fixed version of objc.
@bors-servo r+ |
📌 Commit 0a1b0d6 has been approved by |
Fixes so the compiler can infer msg_send! return types Currently, due to a quirk in Rust's type inference interacting with the structure of the `msg_send!` macro, a `()` return type will be inferred when the compiler cannot otherwise determine the return type. This behavior is expected to change, and in the future could resolve to a `!` return type, which results in undefined behavior. Linting has previously been added for this in rust-lang/rust#39216, but it did not catch these cases due to SSheldon/rust-objc#62. An upcoming version of objc will be fixed to stop hiding these errors, at which point they will become compile errors. This change fixes these errors and allows cocoa to compile with the fixed version of objc.
☀️ Test successful - checks-travis |
Thanks @jdm! Related: how do y'all feel about backported versions here? There's still crates relying on cocoa 0.18 that will need these fixes (primarily glutin and winit). glutin and winit have already moved on to developing alpha versions of their next releases. So either we can backport a cocoa 0.18 fix here or they can backport fixes that update to cocoa 0.19 to get this fix. If I can do something to make a cocoa 0.18.5, that means fewer PRs overall for me 😛 |
As I'm exploring more of the dependency graph, I'm thinking the backport option would be more and more helpful 😛 If you're amenable to it, I've prepared a branch that backports this fix: https://github.com/SSheldon/core-foundation-rs/tree/backport_0.18.5 |
Update cocoa version to 0.19.1 New version needed so that the #340 fixes can be published.
@jdm @SimonSapin is there anyone I can talk to about a backport release? Sorry, not sure the right venue/way to bring this up. I think a backport for 0.18 would be really helpful; as described in rust-lang/rust#65355 (comment), over a third of the downloads for cocoa are still the 0.18 release. |
A backport release makes sense. I'll try and figure out the logistics of how to do that based on your branch. |
Fixes so the compiler can infer msg_send! return types (backport to 0.18) This is a backport of #340 onto the 0.18 release. Currently, due to a quirk in Rust's type inference interacting with the structure of the `msg_send!` macro, a `()` return type will be inferred when the compiler cannot otherwise determine the return type. This behavior is expected to change, and in the future could resolve to a `!` return type, which results in undefined behavior. Linting has previously been added for this in rust-lang/rust#39216, but it did not catch these cases due to SSheldon/rust-objc#62. An upcoming version of objc will be fixed to stop hiding these errors, at which point they will become compile errors. This change fixes these errors and allows cocoa to compile with the fixed version of objc.
101: Bump winit r=kvark a=SSheldon The version of winit used in the window example pins an old version of cocoa lacking a soundness fix (servo/core-foundation-rs#340) for undefined behavior in an upcoming version of rust (rust-lang/rust#65355). Testing done: ran the window example after this change; it compiles and looks fine! Co-authored-by: Steven Sheldon <steven@sasheldon.com>
Currently, due to a quirk in Rust's type inference interacting with the structure of the
msg_send!
macro, a()
return type will be inferred when the compiler cannot otherwise determine the return type. This behavior is expected to change, and in the future could resolve to a!
return type, which results in undefined behavior.Linting has previously been added for this in rust-lang/rust#39216, but it did not catch these cases due to SSheldon/rust-objc#62. An upcoming version of objc will be fixed to stop hiding these errors, at which point they will become compile errors.
This change fixes these errors and allows cocoa to compile with the fixed version of objc.