File tree Expand file tree Collapse file tree 3 files changed +27
-27
lines changed Expand file tree Collapse file tree 3 files changed +27
-27
lines changed Original file line number Diff line number Diff line change 4
4
5
5
/// Interfaces used for comparison.
6
6
7
+ // Awful hack to work around duplicate lang items in core test.
7
8
#[ cfg( notest) ]
8
9
#[ lang="ord" ]
9
10
trait Ord {
10
11
pure fn lt ( & & other: self ) -> bool ;
11
12
}
12
13
14
+ #[ cfg( test) ]
15
+ trait Ord {
16
+ pure fn lt ( & & other: self ) -> bool ;
17
+ }
18
+
13
19
#[ cfg( notest) ]
14
20
#[ lang="eq" ]
15
21
trait Eq {
16
22
pure fn eq ( & & other: self ) -> bool ;
17
23
}
18
24
19
- #[ cfg( notest) ]
25
+ #[ cfg( test) ]
26
+ trait Eq {
27
+ pure fn eq ( & & other: self ) -> bool ;
28
+ }
29
+
20
30
pure fn lt < T : Ord > ( v1 : & T , v2 : & T ) -> bool {
21
31
v1. lt ( * v2)
22
32
}
23
33
24
- #[ cfg( notest) ]
25
34
pure fn le < T : Ord Eq > ( v1 : & T , v2 : & T ) -> bool {
26
35
v1. lt ( * v2) || v1. eq ( * v2)
27
36
}
28
37
29
- #[ cfg( notest) ]
30
38
pure fn eq < T : Eq > ( v1 : & T , v2 : & T ) -> bool {
31
39
v1. eq ( * v2)
32
40
}
Original file line number Diff line number Diff line change 1
1
import T = inst:: T ;
2
+ import cmp:: { Eq , Ord } ;
2
3
import num:: from_int;
3
4
4
5
export min_value, max_value;
@@ -62,20 +63,15 @@ pure fn abs(i: T) -> T {
62
63
if is_negative ( i) { -i } else { i }
63
64
}
64
65
65
- #[ cfg( notest) ]
66
- mod impls {
67
- import cmp:: { Eq , Ord } ;
68
-
69
- impl T : Ord {
70
- pure fn lt ( & & other: T ) -> bool {
71
- return self < other;
72
- }
66
+ impl T : Ord {
67
+ pure fn lt ( & & other: T ) -> bool {
68
+ return self < other;
73
69
}
70
+ }
74
71
75
- impl T : Eq {
76
- pure fn eq ( & & other: T ) -> bool {
77
- return self == other;
78
- }
72
+ impl T : Eq {
73
+ pure fn eq ( & & other: T ) -> bool {
74
+ return self == other;
79
75
}
80
76
}
81
77
Original file line number Diff line number Diff line change 1
1
import T = inst:: T ;
2
+ import cmp:: { Eq , Ord } ;
2
3
3
4
export min_value, max_value;
4
5
export min, max;
@@ -55,20 +56,15 @@ pure fn compl(i: T) -> T {
55
56
max_value ^ i
56
57
}
57
58
58
- #[ cfg( notest) ]
59
- mod impls {
60
- import cmp:: { Eq , Ord } ;
61
-
62
- impl T : Ord {
63
- pure fn lt ( & & other: T ) -> bool {
64
- return self < other;
65
- }
59
+ impl T : Ord {
60
+ pure fn lt ( & & other: T ) -> bool {
61
+ return self < other;
66
62
}
63
+ }
67
64
68
- impl T : Eq {
69
- pure fn eq ( & & other: T ) -> bool {
70
- return self == other;
71
- }
65
+ impl T : Eq {
66
+ pure fn eq ( & & other: T ) -> bool {
67
+ return self == other;
72
68
}
73
69
}
74
70
You can’t perform that action at this time.
0 commit comments