-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Remove Send + Sync
bounds from PartialReflect
and friends (and move the constraint to usages thereof)
#16993
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
base: main
Are you sure you want to change the base?
Remove Send + Sync
bounds from PartialReflect
and friends (and move the constraint to usages thereof)
#16993
Conversation
Send + Sync
bounds from PartialReflect
and Reflect
Send + Sync
bounds from PartialReflect
and Reflect
Send + Sync
bounds from PartialReflect
and friends
I might pick this up again in 4 or 5 weeks when rust 1.86 lands, which includes rust-lang/rust#65991 |
Cutting from the milestone: there's nothing urgent about this, as much as I think it's great. |
bd7fb7c
to
5452393
Compare
Send + Sync
bounds from PartialReflect
and friendsSend + Sync
bounds from PartialReflect
and friends (and move the constraint to usages thereof)
A follow up is needed to remove the |
@@ -691,16 +691,17 @@ mod tests { | |||
"Inserting the asset should result in a strong count of 1" | |||
); | |||
|
|||
let reflected: &dyn Reflect = &handle; | |||
let _cloned_handle: Box<dyn Reflect> = reflected.reflect_clone().unwrap(); | |||
let reflected: &(dyn Reflect + Send + Sync) = &handle; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are the bounds necessary here?
@@ -106,32 +106,34 @@ where | |||
/// Casts this type to a boxed, reflected value. | |||
/// | |||
/// This is useful for coercing trait objects. | |||
fn into_partial_reflect(self: Box<Self>) -> Box<dyn PartialReflect>; | |||
fn into_partial_reflect(self: Box<Self>) -> Box<dyn PartialReflect + Send + Sync>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, I feel like this sort of defeats the purpose, no?
The only way we can return Box::new(self)
here is if Self: Send + Sync
.
Objective
Fixes #16713
Solution
Move the bounds to the usage sites
Disclaimer
If you read this while it is a draft, be aware that this is not ready for a round of full feedback.