-
-
Notifications
You must be signed in to change notification settings - Fork 79
Make implementing ClassType in declare_class! safe #528
Copy link
Copy link
Open
Labels
A-objc2Affects the `objc2`, `objc2-exception-helper` and/or `objc2-encode` cratesAffects the `objc2`, `objc2-exception-helper` and/or `objc2-encode` cratesenhancementNew feature or requestNew feature or request
Milestone
Description
Activity
Metadata
Metadata
Assignees
Labels
A-objc2Affects the `objc2`, `objc2-exception-helper` and/or `objc2-encode` cratesAffects the `objc2`, `objc2-exception-helper` and/or `objc2-encode` cratesenhancementNew feature or requestNew feature or request
Implementing
ClassTypeindeclare_class!isunsafebecause we need the user to uphold a few safety guarantees, and that was just the most convenient place to put theunsafekeyword.After #521 though, the only safety guarantees that the user needs to uphold are:
ClassType::Supermay have must be upheld.ClassType::Mutabilitymust be correct.Dropmust be implemented correctly.We should work on ways to make fulfilling these
unsaferequirements more granular.One possibility for requirement 2 would be to migrate from an associated type
Mutabilityto a constant, that you must initialize withunsafeif you need certain features: