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

Fix main thread requirements on protocols #509

Merged
merged 8 commits into from
Sep 11, 2023
Merged

Conversation

madsmtm
Copy link
Owner

@madsmtm madsmtm commented Sep 11, 2023

In #359 I implemented marking classes as MainThreadOnly, but a glaring omission there is that protocols were not yet marked in a similar way.

This PR rectifies that by changing how the mutability traits work, allowing implementing them for ProtocolObject<P> as well, which means we can now add "requirements" to protocols, such as trait MyProtocol: IsMainThreadOnly, or trait MyProtocol: IsRetainable.

We're still missing IsRetainable bounds on pretty much everything in AppKit (and others) before we can make protocol overriding safe, but now at least the capability of adding those attributes is there.

@madsmtm madsmtm mentioned this pull request Sep 11, 2023
4 tasks
@madsmtm madsmtm added bug Something isn't working enhancement New feature or request A-objc2 Affects the `objc2`, `objc2-exception-helper` and/or `objc2-encode` crates A-framework Affects the framework crates and the translator for them labels Sep 11, 2023
@madsmtm madsmtm added this to the Usable icrate milestone Sep 11, 2023
@madsmtm madsmtm force-pushed the protocol-requirements branch 2 times, most recently from 933225f to 06e60b7 Compare September 11, 2023 14:24
@madsmtm madsmtm merged commit d4cd63b into master Sep 11, 2023
19 checks passed
@madsmtm madsmtm deleted the protocol-requirements branch September 11, 2023 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-framework Affects the framework crates and the translator for them A-objc2 Affects the `objc2`, `objc2-exception-helper` and/or `objc2-encode` crates bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant