Skip to content

Commit e122964

Browse files
committed
---
yaml --- r: 46872 b: refs/heads/auto c: bef5396 h: refs/heads/master v: v3
1 parent 396849d commit e122964

File tree

3 files changed

+48
-4
lines changed

3 files changed

+48
-4
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1414
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1515
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1616
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
17-
refs/heads/auto: a5fae1dac71567b3c9b455e69c1fe74e46945f4d
17+
refs/heads/auto: bef5396af68b5a7d181bef70a920a910416d9094

branches/auto/src/libcore/clone.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,31 @@ impl Clone for () {
1919
#[inline(always)]
2020
fn clone(&self) -> () { () }
2121
}
22+
23+
macro_rules! clone_impl(
24+
($t:ty) => {
25+
impl Clone for $t {
26+
#[inline(always)]
27+
fn clone(&self) -> $t { *self }
28+
}
29+
}
30+
)
31+
32+
clone_impl!(int)
33+
clone_impl!(i8)
34+
clone_impl!(i16)
35+
clone_impl!(i32)
36+
clone_impl!(i64)
37+
38+
clone_impl!(uint)
39+
clone_impl!(u8)
40+
clone_impl!(u16)
41+
clone_impl!(u32)
42+
clone_impl!(u64)
43+
44+
clone_impl!(float)
45+
clone_impl!(f32)
46+
clone_impl!(f64)
47+
48+
clone_impl!(bool)
49+
clone_impl!(char)

branches/auto/src/test/run-pass/deriving-clone-struct.rs

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,24 @@
11
#[deriving_clone]
22
struct S {
3-
foo: (),
4-
bar: ()
3+
_int: int,
4+
_i8: i8,
5+
_i16: i16,
6+
_i32: i32,
7+
_i64: i64,
8+
9+
_uint: uint,
10+
_u8: u8,
11+
_u16: u16,
12+
_u32: u32,
13+
_u64: u64,
14+
15+
_float: float,
16+
_f32: f32,
17+
_f64: f64,
18+
19+
_bool: bool,
20+
_char: char,
21+
_nil: ()
522
}
623

724
fn main() {}
8-

0 commit comments

Comments
 (0)