8
8
// option. This file may not be copied, modified, or distributed
9
9
// except according to those terms.
10
10
11
- // `#[derive(Trait)]` works for empty structs/variants with braces
11
+ // `#[derive(Trait)]` works for empty structs/variants with braces or parens.
12
12
13
+ #![ feature( relaxed_adts) ]
13
14
#![ feature( rustc_private) ]
14
15
15
16
extern crate serialize as rustc_serialize;
@@ -18,11 +19,16 @@ extern crate serialize as rustc_serialize;
18
19
Default , Debug , RustcEncodable , RustcDecodable ) ]
19
20
struct S { }
20
21
22
+ #[ derive( Clone , Copy , PartialEq , Eq , PartialOrd , Ord , Hash ,
23
+ Default , Debug , RustcEncodable , RustcDecodable ) ]
24
+ struct Z ( ) ;
25
+
21
26
#[ derive( Clone , Copy , PartialEq , Eq , PartialOrd , Ord , Hash ,
22
27
Debug , RustcEncodable , RustcDecodable ) ]
23
28
enum E {
24
29
V { } ,
25
30
U ,
31
+ W ( ) ,
26
32
}
27
33
28
34
fn main ( ) {
@@ -34,11 +40,27 @@ fn main() {
34
40
assert ! ( !( s < s1) ) ;
35
41
assert_eq ! ( format!( "{:?}" , s) , "S" ) ;
36
42
43
+ let z = Z ( ) ;
44
+ let z1 = z;
45
+ let z2 = z. clone ( ) ;
46
+ assert_eq ! ( z, z1) ;
47
+ assert_eq ! ( z, z2) ;
48
+ assert ! ( !( z < z1) ) ;
49
+ assert_eq ! ( format!( "{:?}" , z) , "Z" ) ;
50
+
37
51
let e = E :: V { } ;
38
52
let e1 = e;
39
53
let e2 = e. clone ( ) ;
40
54
assert_eq ! ( e, e1) ;
41
55
assert_eq ! ( e, e2) ;
42
56
assert ! ( !( e < e1) ) ;
43
57
assert_eq ! ( format!( "{:?}" , e) , "V" ) ;
58
+
59
+ let e = E :: W ( ) ;
60
+ let e1 = e;
61
+ let e2 = e. clone ( ) ;
62
+ assert_eq ! ( e, e1) ;
63
+ assert_eq ! ( e, e2) ;
64
+ assert ! ( !( e < e1) ) ;
65
+ assert_eq ! ( format!( "{:?}" , e) , "W" ) ;
44
66
}
0 commit comments