577577#![ stable( feature = "rust1" , since = "1.0.0" ) ]
578578
579579use crate :: iter:: { self , FusedIterator , TrustedLen } ;
580+ use crate :: marker:: Destruct ;
580581use crate :: ops:: { self , ControlFlow , Deref , DerefMut } ;
581582use crate :: panicking:: { panic, panic_display} ;
582583use crate :: pin:: Pin ;
@@ -2087,9 +2088,10 @@ const fn expect_failed(msg: &str) -> ! {
20872088/////////////////////////////////////////////////////////////////////////////
20882089
20892090#[ stable( feature = "rust1" , since = "1.0.0" ) ]
2090- impl < T > Clone for Option < T >
2091+ #[ rustc_const_unstable( feature = "const_trait_impl" , issue = "67792" ) ]
2092+ impl < T > const Clone for Option < T >
20912093where
2092- T : Clone ,
2094+ T : ~ const Clone + ~ const Destruct ,
20932095{
20942096 #[ inline]
20952097 fn clone ( & self ) -> Self {
@@ -2173,7 +2175,8 @@ impl<'a, T> IntoIterator for &'a mut Option<T> {
21732175}
21742176
21752177#[ stable( since = "1.12.0" , feature = "option_from" ) ]
2176- impl < T > From < T > for Option < T > {
2178+ #[ rustc_const_unstable( feature = "const_trait_impl" , issue = "67792" ) ]
2179+ impl < T > const From < T > for Option < T > {
21772180 /// Moves `val` into a new [`Some`].
21782181 ///
21792182 /// # Examples
@@ -2189,7 +2192,8 @@ impl<T> From<T> for Option<T> {
21892192}
21902193
21912194#[ stable( feature = "option_ref_from_ref_option" , since = "1.30.0" ) ]
2192- impl < ' a , T > From < & ' a Option < T > > for Option < & ' a T > {
2195+ #[ rustc_const_unstable( feature = "const_trait_impl" , issue = "67792" ) ]
2196+ impl < ' a , T > const From < & ' a Option < T > > for Option < & ' a T > {
21932197 /// Converts from `&Option<T>` to `Option<&T>`.
21942198 ///
21952199 /// # Examples
@@ -2216,7 +2220,8 @@ impl<'a, T> From<&'a Option<T>> for Option<&'a T> {
22162220}
22172221
22182222#[ stable( feature = "option_ref_from_ref_option" , since = "1.30.0" ) ]
2219- impl < ' a , T > From < & ' a mut Option < T > > for Option < & ' a mut T > {
2223+ #[ rustc_const_unstable( feature = "const_trait_impl" , issue = "67792" ) ]
2224+ impl < ' a , T > const From < & ' a mut Option < T > > for Option < & ' a mut T > {
22202225 /// Converts from `&mut Option<T>` to `Option<&mut T>`
22212226 ///
22222227 /// # Examples
@@ -2535,7 +2540,8 @@ impl<A, V: FromIterator<A>> FromIterator<Option<A>> for Option<V> {
25352540}
25362541
25372542#[ unstable( feature = "try_trait_v2" , issue = "84277" , old_name = "try_trait" ) ]
2538- impl < T > ops:: Try for Option < T > {
2543+ #[ rustc_const_unstable( feature = "const_trait_impl" , issue = "67792" ) ]
2544+ impl < T > const ops:: Try for Option < T > {
25392545 type Output = T ;
25402546 type Residual = Option < convert:: Infallible > ;
25412547
@@ -2554,9 +2560,10 @@ impl<T> ops::Try for Option<T> {
25542560}
25552561
25562562#[ unstable( feature = "try_trait_v2" , issue = "84277" , old_name = "try_trait" ) ]
2563+ #[ rustc_const_unstable( feature = "const_trait_impl" , issue = "67792" ) ]
25572564// Note: manually specifying the residual type instead of using the default to work around
25582565// https://github.com/rust-lang/rust/issues/99940
2559- impl < T > ops:: FromResidual < Option < convert:: Infallible > > for Option < T > {
2566+ impl < T > const ops:: FromResidual < Option < convert:: Infallible > > for Option < T > {
25602567 #[ inline]
25612568 fn from_residual ( residual : Option < convert:: Infallible > ) -> Self {
25622569 match residual {
@@ -2567,15 +2574,17 @@ impl<T> ops::FromResidual<Option<convert::Infallible>> for Option<T> {
25672574
25682575#[ diagnostic:: do_not_recommend]
25692576#[ unstable( feature = "try_trait_v2_yeet" , issue = "96374" ) ]
2570- impl < T > ops:: FromResidual < ops:: Yeet < ( ) > > for Option < T > {
2577+ #[ rustc_const_unstable( feature = "const_trait_impl" , issue = "67792" ) ]
2578+ impl < T > const ops:: FromResidual < ops:: Yeet < ( ) > > for Option < T > {
25712579 #[ inline]
25722580 fn from_residual ( ops:: Yeet ( ( ) ) : ops:: Yeet < ( ) > ) -> Self {
25732581 None
25742582 }
25752583}
25762584
25772585#[ unstable( feature = "try_trait_v2_residual" , issue = "91285" ) ]
2578- impl < T > ops:: Residual < T > for Option < convert:: Infallible > {
2586+ #[ rustc_const_unstable( feature = "const_trait_impl" , issue = "67792" ) ]
2587+ impl < T > const ops:: Residual < T > for Option < convert:: Infallible > {
25792588 type TryType = Option < T > ;
25802589}
25812590
0 commit comments