You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CtSelect has both methods ct_select and ct_assign, where the latter is provided (there's also a ct_swap).
CtSelect also as a Sized bound, so it can't be impl'd for e.g. slices. But a hypothetical CtAssign trait (which could also have a ct_swap method) has no need for a Sized bound.
It annoyingly means that there are two traits to impl instead of one, but while we could add a blanket impl, there's not an efficient general implementation of either in terms of the other and it would be nice to permit efficient implementations of both. So I would suggest against a blanket impl.
One thing we could do though is CtSelect: CtAssign + Sized to ensure that any types with CtSelect impls also have CtAssign impls.
I was noticing this looking at the Cmov trait and how it doesn't have this problem.
Activity
tarcieri commentedon Jan 19, 2026
This was implemented in #1356