@@ -129,7 +129,7 @@ use crate::ops::ControlFlow;
129129#[ doc( alias = "?" ) ]
130130#[ lang = "Try" ]
131131#[ const_trait]
132- pub trait Try : FromResidual {
132+ pub trait Try : ~ const FromResidual {
133133 /// The type of the value produced by `?` when *not* short-circuiting.
134134 #[ unstable( feature = "try_trait_v2" , issue = "84277" ) ]
135135 type Output ;
@@ -438,10 +438,11 @@ where
438438/// and in the other direction,
439439/// `<Result<Infallible, E> as Residual<T>>::TryType = Result<T, E>`.
440440#[ unstable( feature = "try_trait_v2_residual" , issue = "91285" ) ]
441+ #[ const_trait]
441442pub trait Residual < O > {
442443 /// The "return" type of this meta-function.
443444 #[ unstable( feature = "try_trait_v2_residual" , issue = "91285" ) ]
444- type TryType : Try < Output = O , Residual = Self > ;
445+ type TryType : ~ const Try < Output = O , Residual = Self > ;
445446}
446447
447448#[ unstable( feature = "pub_crate_should_not_need_unstable_attr" , issue = "none" ) ]
@@ -460,14 +461,17 @@ pub(crate) struct NeverShortCircuit<T>(pub T);
460461impl < T > NeverShortCircuit < T > {
461462 /// Wrap a binary `FnMut` to return its result wrapped in a `NeverShortCircuit`.
462463 #[ inline]
463- pub fn wrap_mut_2 < A , B > ( mut f : impl FnMut ( A , B ) -> T ) -> impl FnMut ( A , B ) -> Self {
464- move |a, b| NeverShortCircuit ( f ( a, b) )
464+ pub const fn wrap_mut_2_imp < A , B , F : ~const FnMut ( A , B ) -> T > (
465+ f : & mut F ,
466+ ( a, b) : ( A , B ) ,
467+ ) -> NeverShortCircuit < T > {
468+ NeverShortCircuit ( f ( a, b) )
465469 }
466470}
467471
468472pub ( crate ) enum NeverShortCircuitResidual { }
469473
470- impl < T > Try for NeverShortCircuit < T > {
474+ impl < T > const Try for NeverShortCircuit < T > {
471475 type Output = T ;
472476 type Residual = NeverShortCircuitResidual ;
473477
@@ -482,14 +486,14 @@ impl<T> Try for NeverShortCircuit<T> {
482486 }
483487}
484488
485- impl < T > FromResidual for NeverShortCircuit < T > {
489+ impl < T > const FromResidual for NeverShortCircuit < T > {
486490 #[ inline]
487491 fn from_residual ( never : NeverShortCircuitResidual ) -> Self {
488492 match never { }
489493 }
490494}
491495
492- impl < T > Residual < T > for NeverShortCircuitResidual {
496+ impl < T > const Residual < T > for NeverShortCircuitResidual {
493497 type TryType = NeverShortCircuit < T > ;
494498}
495499
0 commit comments