Skip to content

Commit 779a304

Browse files
committed
---
yaml --- r: 30389 b: refs/heads/incoming c: feb014e h: refs/heads/master i: 30387: 8b511a8 v: v3
1 parent 2123d5a commit 779a304

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+219
-61
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
9-
refs/heads/incoming: ac1f84c153a171e641233e5d2d11404a0b520986
9+
refs/heads/incoming: feb014eb3c3aa1ccaae1df407801dffa090499fd
1010
refs/heads/dist-snap: 2f32a1581f522e524009138b33b1c7049ced668d
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/src/cargo/cargo.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ impl mode : cmp::Eq {
100100
pure fn eq(&&other: mode) -> bool {
101101
(self as uint) == (other as uint)
102102
}
103+
pure fn ne(&&other: mode) -> bool { !self.eq(other) }
103104
}
104105

105106
fn opts() -> ~[getopts::Opt] {

branches/incoming/src/compiletest/common.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ impl mode : cmp::Eq {
66
pure fn eq(&&other: mode) -> bool {
77
other as int == self as int
88
}
9+
pure fn ne(&&other: mode) -> bool { !self.eq(other) }
910
}
1011

1112
type config = {

branches/incoming/src/fuzzer/fuzzer.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ impl test_mode : cmp::Eq {
1212
pure fn eq(&&other: test_mode) -> bool {
1313
(self as uint) == (other as uint)
1414
}
15+
pure fn ne(&&other: test_mode) -> bool { !self.eq(other) }
1516
}
1617

1718
fn write_file(filename: &Path, content: ~str) {

branches/incoming/src/libcore/bool.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,8 @@ fn all_values(blk: fn(v: bool)) {
7070
pure fn to_bit(v: bool) -> u8 { if v { 1u8 } else { 0u8 } }
7171

7272
impl bool : cmp::Eq {
73-
pure fn eq(&&other: bool) -> bool {
74-
self == other
75-
}
73+
pure fn eq(&&other: bool) -> bool { self == other }
74+
pure fn ne(&&other: bool) -> bool { self != other }
7675
}
7776

7877
#[test]

branches/incoming/src/libcore/box.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ pure fn ptr_eq<T>(a: @T, b: @T) -> bool {
1515

1616
impl<T:Eq> @const T : Eq {
1717
pure fn eq(&&other: @const T) -> bool { *self == *other }
18+
pure fn ne(&&other: @const T) -> bool { *self != *other }
1819
}
1920

2021
impl<T:Ord> @const T : Ord {

branches/incoming/src/libcore/char.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ pure fn cmp(a: char, b: char) -> int {
191191

192192
impl char: Eq {
193193
pure fn eq(&&other: char) -> bool { self == other }
194+
pure fn ne(&&other: char) -> bool { self != other }
194195
}
195196

196197
#[test]

branches/incoming/src/libcore/cmp.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@ trait Ord {
2626
#[lang="eq"]
2727
trait Eq {
2828
pure fn eq(&&other: self) -> bool;
29+
pure fn ne(&&other: self) -> bool;
2930
}
3031

3132
#[cfg(test)]
3233
trait Eq {
3334
pure fn eq(&&other: self) -> bool;
35+
pure fn ne(&&other: self) -> bool;
3436
}
3537

3638
pure fn lt<T: Ord>(v1: &T, v2: &T) -> bool {
@@ -45,6 +47,10 @@ pure fn eq<T: Eq>(v1: &T, v2: &T) -> bool {
4547
v1.eq(v2)
4648
}
4749

50+
pure fn ne<T: Eq>(v1: &T, v2: &T) -> bool {
51+
v1.ne(v2)
52+
}
53+
4854
pure fn ge<T: Ord>(v1: &T, v2: &T) -> bool {
4955
v1.ge(v2)
5056
}

branches/incoming/src/libcore/either.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ impl<T:Eq,U:Eq> Either<T,U> : Eq {
143143
}
144144
}
145145
}
146+
pure fn ne(&&other: Either<T,U>) -> bool { !self.eq(other) }
146147
}
147148

148149
#[test]

branches/incoming/src/libcore/extfmt.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,7 @@ mod rt {
401401
(pad_float, _) => false
402402
}
403403
}
404+
pure fn ne(&&other: pad_mode) -> bool { !self.eq(other) }
404405
}
405406

406407
fn pad(cv: conv, &s: ~str, mode: pad_mode) -> ~str {

branches/incoming/src/libcore/float.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,7 @@ pure fn tan(x: float) -> float { f64::tan(x as f64) as float }
416416

417417
impl float: Eq {
418418
pure fn eq(&&other: float) -> bool { self == other }
419+
pure fn ne(&&other: float) -> bool { self != other }
419420
}
420421

421422
impl float: Ord {

branches/incoming/src/libcore/int-template.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,8 @@ impl T: Ord {
7676
}
7777

7878
impl T: Eq {
79-
pure fn eq(&&other: T) -> bool {
80-
return self == other;
81-
}
79+
pure fn eq(&&other: T) -> bool { return self == other; }
80+
pure fn ne(&&other: T) -> bool { return self != other; }
8281
}
8382

8483
impl T: num::Num {

branches/incoming/src/libcore/io.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@ impl WriterType: Eq {
337337
(Screen, _) | (File, _) => false
338338
}
339339
}
340+
pure fn ne(&&other: WriterType) -> bool { !self.eq(other) }
340341
}
341342

342343
// FIXME (#2004): Seekable really should be orthogonal.

branches/incoming/src/libcore/option.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ impl<T: Eq> Option<T> : Eq {
266266
}
267267
}
268268
}
269+
pure fn ne(&&other: Option<T>) -> bool { !self.eq(other) }
269270
}
270271

271272
#[test]

branches/incoming/src/libcore/path.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ impl PosixPath : Eq {
6969
return self.is_absolute == other.is_absolute &&
7070
self.components == other.components;
7171
}
72+
pure fn ne(&&other: PosixPath) -> bool { !self.eq(other) }
7273
}
7374

7475
impl WindowsPath : Eq {
@@ -78,6 +79,7 @@ impl WindowsPath : Eq {
7879
self.is_absolute == other.is_absolute &&
7980
self.components == other.components;
8081
}
82+
pure fn ne(&&other: WindowsPath) -> bool { !self.eq(other) }
8183
}
8284

8385
// FIXME (#3227): when default methods in traits are working, de-duplicate

branches/incoming/src/libcore/pipes.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ impl State: Eq {
128128
pure fn eq(&&other: State) -> bool {
129129
(self as uint) == (other as uint)
130130
}
131+
pure fn ne(&&other: State) -> bool { !self.eq(other) }
131132
}
132133

133134
struct BufferHeader {

branches/incoming/src/libcore/ptr.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ impl<T> *const T : Eq {
188188
let b: uint = unsafe::reinterpret_cast(&other);
189189
return a == b;
190190
}
191+
pure fn ne(&&other: *const T) -> bool { !self.eq(other) }
191192
}
192193

193194
// Comparison for pointers
@@ -216,9 +217,8 @@ impl<T> *const T : Ord {
216217

217218
// Equality for region pointers
218219
impl<T:Eq> &const T : Eq {
219-
pure fn eq(&&other: &const T) -> bool {
220-
return *self == *other;
221-
}
220+
pure fn eq(&&other: &const T) -> bool { return *self == *other; }
221+
pure fn ne(&&other: &const T) -> bool { return *self != *other; }
222222
}
223223

224224
// Comparison for region pointers

branches/incoming/src/libcore/result.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,7 @@ impl<T:Eq,U:Eq> Result<T,U> : Eq {
373373
}
374374
}
375375
}
376+
pure fn ne(&&other: Result<T,U>) -> bool { !self.eq(other) }
376377
}
377378

378379
#[cfg(test)]

branches/incoming/src/libcore/str.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -780,20 +780,26 @@ impl &str: Eq {
780780
pure fn eq(&&other: &str) -> bool {
781781
eq_slice(self, other)
782782
}
783+
#[inline(always)]
784+
pure fn ne(&&other: &str) -> bool { !self.eq(other) }
783785
}
784786

785787
impl ~str: Eq {
786788
#[inline(always)]
787789
pure fn eq(&&other: ~str) -> bool {
788790
eq_slice(self, other)
789791
}
792+
#[inline(always)]
793+
pure fn ne(&&other: ~str) -> bool { !self.eq(other) }
790794
}
791795

792796
impl @str: Eq {
793797
#[inline(always)]
794798
pure fn eq(&&other: @str) -> bool {
795799
eq_slice(self, other)
796800
}
801+
#[inline(always)]
802+
pure fn ne(&&other: @str) -> bool { !self.eq(other) }
797803
}
798804

799805
impl ~str : Ord {

branches/incoming/src/libcore/task.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,8 @@ enum Task {
8585
}
8686

8787
impl Task : cmp::Eq {
88-
pure fn eq(&&other: Task) -> bool {
89-
*self == *other
90-
}
88+
pure fn eq(&&other: Task) -> bool { *self == *other }
89+
pure fn ne(&&other: Task) -> bool { !self.eq(other) }
9190
}
9291

9392
/**
@@ -113,6 +112,7 @@ impl TaskResult: Eq {
113112
(Success, _) | (Failure, _) => false
114113
}
115114
}
115+
pure fn ne(&&other: TaskResult) -> bool { !self.eq(other) }
116116
}
117117

118118
/// A message type for notifying of task lifecycle events
@@ -131,6 +131,7 @@ impl Notification : cmp::Eq {
131131
}
132132
}
133133
}
134+
pure fn ne(&&other: Notification) -> bool { !self.eq(other) }
134135
}
135136

136137
/// Scheduler modes
@@ -1324,6 +1325,7 @@ impl LocalData: Eq {
13241325
let ptr_b: (uint, uint) = unsafe::reinterpret_cast(&other);
13251326
return ptr_a == ptr_b;
13261327
}
1328+
pure fn ne(&&other: LocalData) -> bool { !self.eq(other) }
13271329
}
13281330

13291331
// We use dvec because it's the best data structure in core. If TLS is used

branches/incoming/src/libcore/tuple.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ impl<A: Eq, B: Eq> (A, B): Eq {
8181
}
8282
}
8383
}
84+
pure fn ne(&&other: (A, B)) -> bool { !self.eq(other) }
8485
}
8586

8687
impl<A: Ord, B: Ord> (A, B): Ord {
@@ -119,6 +120,7 @@ impl<A: Eq, B: Eq, C: Eq> (A, B, C): Eq {
119120
}
120121
}
121122
}
123+
pure fn ne(&&other: (A, B, C)) -> bool { !self.eq(other) }
122124
}
123125

124126
impl<A: Ord, B: Ord, C: Ord> (A, B, C): Ord {

branches/incoming/src/libcore/uint-template.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,8 @@ impl T: Ord {
6969
}
7070

7171
impl T: Eq {
72-
pure fn eq(&&other: T) -> bool {
73-
return self == other;
74-
}
72+
pure fn eq(&&other: T) -> bool { return self == other; }
73+
pure fn ne(&&other: T) -> bool { return self != other; }
7574
}
7675

7776
impl T: num::Num {

branches/incoming/src/libcore/uniq.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use cmp::{Eq, Ord};
44

55
impl<T:Eq> ~const T : Eq {
66
pure fn eq(&&other: ~const T) -> bool { *self == *other }
7+
pure fn ne(&&other: ~const T) -> bool { *self != *other }
78
}
89

910
impl<T:Ord> ~const T : Ord {

branches/incoming/src/libcore/unit.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use cmp::{Eq, Ord};
66

77
impl () : Eq {
88
pure fn eq(&&_other: ()) -> bool { true }
9+
pure fn ne(&&_other: ()) -> bool { false }
910
}
1011

1112
impl () : Ord {

branches/incoming/src/libcore/vec.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1406,23 +1406,23 @@ pure fn eq<T: Eq>(a: &[T], b: &[T]) -> bool {
14061406

14071407
impl<T: Eq> &[T]: Eq {
14081408
#[inline(always)]
1409-
pure fn eq(&&other: &[T]) -> bool {
1410-
eq(self, other)
1411-
}
1409+
pure fn eq(&&other: &[T]) -> bool { eq(self, other) }
1410+
#[inline(always)]
1411+
pure fn ne(&&other: &[T]) -> bool { !self.eq(other) }
14121412
}
14131413

14141414
impl<T: Eq> ~[T]: Eq {
14151415
#[inline(always)]
1416-
pure fn eq(&&other: ~[T]) -> bool {
1417-
eq(self, other)
1418-
}
1416+
pure fn eq(&&other: ~[T]) -> bool { eq(self, other) }
1417+
#[inline(always)]
1418+
pure fn ne(&&other: ~[T]) -> bool { !self.eq(other) }
14191419
}
14201420

14211421
impl<T: Eq> @[T]: Eq {
14221422
#[inline(always)]
1423-
pure fn eq(&&other: @[T]) -> bool {
1424-
eq(self, other)
1425-
}
1423+
pure fn eq(&&other: @[T]) -> bool { eq(self, other) }
1424+
#[inline(always)]
1425+
pure fn ne(&&other: @[T]) -> bool { !self.eq(other) }
14261426
}
14271427

14281428
// Lexicographical comparison

branches/incoming/src/libstd/getopts.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,14 @@ impl Name : Eq {
124124
}
125125
}
126126
}
127+
pure fn ne(&&other: Name) -> bool { !self.eq(other) }
127128
}
128129

129130
impl Occur : Eq {
130131
pure fn eq(&&other: Occur) -> bool {
131132
(self as uint) == (other as uint)
132133
}
134+
pure fn ne(&&other: Occur) -> bool { !self.eq(other) }
133135
}
134136

135137
/// Create an option that is required and takes an argument
@@ -449,6 +451,7 @@ impl FailType : Eq {
449451
pure fn eq(&&other: FailType) -> bool {
450452
(self as uint) == (other as uint)
451453
}
454+
pure fn ne(&&other: FailType) -> bool { !self.eq(other) }
452455
}
453456

454457
#[cfg(test)]

branches/incoming/src/libstd/json.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -609,12 +609,12 @@ impl Error : Eq {
609609
self.col == other.col &&
610610
self.msg == other.msg
611611
}
612+
pure fn ne(&&other: Error) -> bool { !self.eq(other) }
612613
}
613614

614615
impl Json : Eq {
615-
pure fn eq(&&other: Json) -> bool {
616-
eq(self, other)
617-
}
616+
pure fn eq(&&other: Json) -> bool { eq(self, other) }
617+
pure fn ne(&&other: Json) -> bool { !self.eq(other) }
618618
}
619619

620620
trait ToJson { fn to_json() -> Json; }

branches/incoming/src/libstd/list.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ impl<T:Eq> List<T> : Eq {
165165
}
166166
}
167167
}
168+
pure fn ne(&&other: List<T>) -> bool { !self.eq(other) }
168169
}
169170

170171
#[cfg(test)]

branches/incoming/src/libstd/net_url.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ impl UserInfo : Eq {
320320
pure fn eq(&&other: UserInfo) -> bool {
321321
self.user == other.user && self.pass == other.pass
322322
}
323+
pure fn ne(&&other: UserInfo) -> bool { !self.eq(other) }
323324
}
324325

325326
fn query_from_str(rawquery: &str) -> Query {
@@ -386,6 +387,7 @@ impl Input: Eq {
386387
(Unreserved, _) => false
387388
}
388389
}
390+
pure fn ne(&&other: Input) -> bool { !self.eq(other) }
389391
}
390392

391393
// returns userinfo, host, port, and unparsed part, or an error

0 commit comments

Comments
 (0)