@@ -1535,11 +1535,17 @@ impl<T, E> Result<&T, E> {
15351535 /// ```
15361536 #[ inline]
15371537 #[ stable( feature = "result_copied" , since = "1.59.0" ) ]
1538- pub fn copied ( self ) -> Result < T , E >
1538+ #[ rustc_const_unstable( feature = "const_result" , issue = "82814" ) ]
1539+ pub const fn copied ( self ) -> Result < T , E >
15391540 where
15401541 T : Copy ,
15411542 {
1542- self . map ( |& t| t)
1543+ // FIXME(const-hack): this implementation, which sidesteps using `Result::map` since it's not const
1544+ // ready yet, should be reverted when possible to avoid code repetition
1545+ match self {
1546+ Ok ( & v) => Ok ( v) ,
1547+ Err ( e) => Err ( e) ,
1548+ }
15431549 }
15441550
15451551 /// Maps a `Result<&T, E>` to a `Result<T, E>` by cloning the contents of the
@@ -1579,11 +1585,17 @@ impl<T, E> Result<&mut T, E> {
15791585 /// ```
15801586 #[ inline]
15811587 #[ stable( feature = "result_copied" , since = "1.59.0" ) ]
1582- pub fn copied ( self ) -> Result < T , E >
1588+ #[ rustc_const_unstable( feature = "const_result" , issue = "82814" ) ]
1589+ pub const fn copied ( self ) -> Result < T , E >
15831590 where
15841591 T : Copy ,
15851592 {
1586- self . map ( |& mut t| t)
1593+ // FIXME(const-hack): this implementation, which sidesteps using `Result::map` since it's not const
1594+ // ready yet, should be reverted when possible to avoid code repetition
1595+ match self {
1596+ Ok ( & mut v) => Ok ( v) ,
1597+ Err ( e) => Err ( e) ,
1598+ }
15871599 }
15881600
15891601 /// Maps a `Result<&mut T, E>` to a `Result<T, E>` by cloning the contents of the
0 commit comments