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

Change ConditionallySelectable supertrait #137

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

tarcieri
Copy link
Contributor

@tarcieri tarcieri commented Aug 3, 2024

To resolve #94, removes the Copy supertrait bound on ConditionallySelectable, replacing it with Sized instead.

It turns out the bound is only used in the default implementation of ConditionallySelectable::conditional_swap, and is easy to replace by slightly changing that default implementation.

Removing this supertrait bound is arguably a breaking change since it means types which impl ConditionallySelectable can no longer be assumed to be Copy, so also bumps the version to 3.0.0-pre.

Alternative to #118, #136

To resolve dalek-cryptography#94, removes the `Copy` supertrait bound on
`ConditionallySelectable`, replacing it with `Sized` instead.

It turns out the bound is only used in the default implementation of
`ConditionallySelectable::conditional_swap`, and is easy to replace by
slightly changing that default implementation.

Removing this supertrait bound is arguably a breaking change since it
means types which impl `ConditionallySelectable` can no longer be
assumed to be `Copy`, so also bumps the version to `3.0.0-pre`.
Copy link
Contributor

@AaronFeickert AaronFeickert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if reviews are welcome from folks without merge authority, but LGTM aside from the MSRV-related CI failure.

@@ -575,7 +575,7 @@ impl ConditionallySelectable for Choice {
#[cfg(feature = "const-generics")]
impl<T, const N: usize> ConditionallySelectable for [T; N]
where
T: ConditionallySelectable,
T: ConditionallySelectable + Copy,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be more flexible if it were Clone instead, and that wouldn't impact performance, but I guess there are worries that Clone impls won't run in constant time

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.

2 participants