Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upFixes 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+ |
|
|
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.
|
|
|
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 |
|
@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>
SSheldon commentedOct 16, 2019
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.