Skip to content

Commit d3e0cdf

Browse files
committed
Revert "Use #[derive] for Copy/Clone in s! and friends."
This reverts commit 44c548d.
1 parent 57dfd5b commit d3e0cdf

File tree

1 file changed

+25
-5
lines changed

1 file changed

+25
-5
lines changed

src/macros.rs

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,16 @@ macro_rules! s {
8282
__item! {
8383
#[repr(C)]
8484
#[cfg_attr(feature = "extra_traits", derive(Debug, Eq, Hash, PartialEq))]
85-
#[derive(Copy, Clone)]
8685
#[allow(deprecated)]
8786
$(#[$attr])*
8887
pub struct $i { $($field)* }
8988
}
89+
#[allow(deprecated)]
90+
impl ::Copy for $i {}
91+
#[allow(deprecated)]
92+
impl ::Clone for $i {
93+
fn clone(&self) -> $i { *self }
94+
}
9095
);
9196
}
9297

@@ -101,10 +106,13 @@ macro_rules! s_paren {
101106
)*) => ($(
102107
__item! {
103108
#[cfg_attr(feature = "extra_traits", derive(Debug, Eq, Hash, PartialEq))]
104-
#[derive(Copy, Clone)]
105109
$(#[$attr])*
106110
pub struct $i ( $($field)* );
107111
}
112+
impl ::Copy for $i {}
113+
impl ::Clone for $i {
114+
fn clone(&self) -> $i { *self }
115+
}
108116
)*);
109117
}
110118

@@ -122,19 +130,28 @@ macro_rules! s_no_extra_traits {
122130
(it: $(#[$attr:meta])* pub union $i:ident { $($field:tt)* }) => (
123131
__item! {
124132
#[repr(C)]
125-
#[derive(Copy, Clone)]
126133
$(#[$attr])*
127134
pub union $i { $($field)* }
128135
}
136+
137+
impl ::Copy for $i {}
138+
impl ::Clone for $i {
139+
fn clone(&self) -> $i { *self }
140+
}
129141
);
130142

131143
(it: $(#[$attr:meta])* pub struct $i:ident { $($field:tt)* }) => (
132144
__item! {
133145
#[repr(C)]
134-
#[derive(Copy, Clone)]
135146
$(#[$attr])*
136147
pub struct $i { $($field)* }
137148
}
149+
#[allow(deprecated)]
150+
impl ::Copy for $i {}
151+
#[allow(deprecated)]
152+
impl ::Clone for $i {
153+
fn clone(&self) -> $i { *self }
154+
}
138155
);
139156
}
140157

@@ -160,10 +177,13 @@ macro_rules! e {
160177
)*) => ($(
161178
__item! {
162179
#[cfg_attr(feature = "extra_traits", derive(Debug, Eq, Hash, PartialEq))]
163-
#[derive(Copy, Clone)]
164180
$(#[$attr])*
165181
pub enum $i { $($field)* }
166182
}
183+
impl ::Copy for $i {}
184+
impl ::Clone for $i {
185+
fn clone(&self) -> $i { *self }
186+
}
167187
)*);
168188
}
169189

0 commit comments

Comments
 (0)