@@ -116,7 +116,10 @@ impl<T> CtOption<T> {
116116 self . value
117117 }
118118
119- /// Return a copy of the contained value without consuming `self`.
119+ /// Return the contained value, consuming the `self` value, with `const fn` support.
120+ ///
121+ /// Relies on a `Copy` bound which implies `!Drop` which is needed to be able to move out of
122+ /// `self` in a `const fn` without `feature(const_precise_live_drops)`.
120123 ///
121124 /// # Panics
122125 /// In the event `self.is_some()` is [`Choice::FALSE`], panics with a custom panic message
@@ -157,6 +160,8 @@ impl<T> CtOption<T> {
157160 /// type inference.
158161 ///
159162 /// <div class="warning">
163+ /// <b>Warning: variable-time!</b>
164+ ///
160165 /// This implementation doesn't intend to be constant-time nor try to protect the leakage of the
161166 /// `T` value since the [`Option`] will do it anyway.
162167 /// </div>
@@ -176,6 +181,8 @@ impl<T> CtOption<T> {
176181 /// `const fn` and destructors.
177182 ///
178183 /// <div class="warning">
184+ /// <b>Warning: variable-time!</b>
185+ ///
179186 /// This implementation doesn't intend to be constant-time nor try to protect the leakage of the
180187 /// `T` value since the [`Option`] will do it anyway.
181188 /// </div>
@@ -310,8 +317,10 @@ impl<T> CtOption<T> {
310317 /// [`Choice::FALSE`].
311318 ///
312319 /// <div class="warning">
320+ /// <b>Warning: variable-time!</b>
321+ ///
313322 /// This implementation doesn't intend to be constant-time nor try to protect the leakage of the
314- /// `T` value since the [`Option `] will do it anyway.
323+ /// `T` value since the [`Result `] will do it anyway.
315324 /// </div>
316325 #[ inline]
317326 pub fn ok_or < E > ( self , err : E ) -> Result < T , E > {
@@ -320,6 +329,13 @@ impl<T> CtOption<T> {
320329
321330 /// Transforms a `CtOption<T>` into a `Result<T, E>` by unconditionally calling the provided
322331 /// callback value and using its result in the event `self.is_some()` is [`Choice::FALSE`].
332+ ///
333+ /// <div class="warning">
334+ /// <b>Warning: variable-time!</b>
335+ ///
336+ /// This implementation doesn't intend to be constant-time nor try to protect the leakage of the
337+ /// `T` value since the [`Result`] will do it anyway.
338+ /// </div>
323339 #[ inline]
324340 pub fn ok_or_else < E , F > ( self , err : F ) -> Result < T , E >
325341 where
@@ -524,10 +540,10 @@ impl<T: Default> Default for CtOption<T> {
524540/// [`CtOption::is_some`] is a truthy or falsy [`Choice`].
525541///
526542/// <div class="warning">
543+ /// <b>Warning: variable-time!</b>
527544///
528545/// This implementation doesn't intend to be constant-time nor try to protect the leakage of the
529546/// `T` value since the `Option` will do it anyway.
530- ///
531547/// </div>
532548impl < T > From < CtOption < T > > for Option < T > {
533549 fn from ( src : CtOption < T > ) -> Option < T > {
0 commit comments