Skip to content

Conversation

@copybara-service
Copy link

Allow the !Unpin impl to be turned off in #[recursively_pinned].

I've tried to explain in the docs why this isn't the default behavior. But for generics especially, it might be that the benefits of doing ?Unpin outweigh the relatively minor costs!

At any rate, there doesn't seem to be a strong need to force !Unpin. The main effect if you do this for a generic type is that some traits become unimplementable, but there's not a strong reason to force all types to be able to implement those traits. They exist primarily for ecosystem compatibility with C++, and there is not, AFAIK, a need to force them to always exist if possible. And anyway, we can't force them to exist: any !Unpin type can choose not to implement them, and there's no user-distinguishable difference between a trait that isn't implemented by choice or by force!

At the end of the day, this is a place where we can experiment and see what happens.

Note: I chose ?Unpin syntax because it seemed most apropos, but I am not sure it is technically correct! The main alternative might be something like Unpin=auto or similar.

I've tried to explain in the docs why this isn't the default behavior. But for generics especially, it might be that the benefits of doing `?Unpin` outweigh the relatively minor costs!

At any rate, there doesn't seem to be a strong need to force `!Unpin`. The main effect if you do this for a generic type is that some traits become unimplementable, but there's not a strong reason to force all types to be able to implement those traits. They exist primarily for ecosystem compatibility with C++, and there is not, AFAIK, a need to force them to always exist if possible. And anyway, we can't force them to exist: any `!Unpin` type can _choose_ not to implement them, and there's no user-distinguishable difference between a trait that isn't implemented by choice or by force!

At the end of the day, this is a place where we can experiment and see what happens.

Note: I chose `?Unpin` syntax because it seemed most apropos, but I am not sure it is technically correct! The main alternative might be something like `Unpin=auto` or similar.
PiperOrigin-RevId: 836831655
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant