@@ -127,7 +127,11 @@ pub trait Clone: Sized {
127127 /// allocations.
128128 #[ inline]
129129 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
130- fn clone_from ( & mut self , source : & Self ) {
130+ #[ default_method_body_is_const]
131+ fn clone_from ( & mut self , source : & Self )
132+ where
133+ Self : ~const Drop ,
134+ {
131135 * self = source. clone ( )
132136 }
133137}
@@ -178,7 +182,8 @@ mod impls {
178182 ( $( $t: ty) * ) => {
179183 $(
180184 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
181- impl Clone for $t {
185+ #[ rustc_const_unstable( feature = "const_clone" , issue = "91805" ) ]
186+ impl const Clone for $t {
182187 #[ inline]
183188 fn clone( & self ) -> Self {
184189 * self
@@ -196,23 +201,26 @@ mod impls {
196201 }
197202
198203 #[ unstable( feature = "never_type" , issue = "35121" ) ]
199- impl Clone for ! {
204+ #[ rustc_const_unstable( feature = "const_clone" , issue = "91805" ) ]
205+ impl const Clone for ! {
200206 #[ inline]
201207 fn clone ( & self ) -> Self {
202208 * self
203209 }
204210 }
205211
206212 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
207- impl < T : ?Sized > Clone for * const T {
213+ #[ rustc_const_unstable( feature = "const_clone" , issue = "91805" ) ]
214+ impl < T : ?Sized > const Clone for * const T {
208215 #[ inline]
209216 fn clone ( & self ) -> Self {
210217 * self
211218 }
212219 }
213220
214221 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
215- impl < T : ?Sized > Clone for * mut T {
222+ #[ rustc_const_unstable( feature = "const_clone" , issue = "91805" ) ]
223+ impl < T : ?Sized > const Clone for * mut T {
216224 #[ inline]
217225 fn clone ( & self ) -> Self {
218226 * self
@@ -221,7 +229,8 @@ mod impls {
221229
222230 /// Shared references can be cloned, but mutable references *cannot*!
223231 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
224- impl < T : ?Sized > Clone for & T {
232+ #[ rustc_const_unstable( feature = "const_clone" , issue = "91805" ) ]
233+ impl < T : ?Sized > const Clone for & T {
225234 #[ inline]
226235 #[ rustc_diagnostic_item = "noop_method_clone" ]
227236 fn clone ( & self ) -> Self {
0 commit comments