Skip to content

Commit 5ac90b9

Browse files
committed
---
yaml --- r: 31460 b: refs/heads/dist-snap c: 9258053 h: refs/heads/master v: v3
1 parent 396690a commit 5ac90b9

File tree

2 files changed

+10
-27
lines changed

2 files changed

+10
-27
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
99
refs/heads/incoming: d9317a174e434d4c99fc1a37fd7dc0d2f5328d37
10-
refs/heads/dist-snap: 73ca5603bd1bf57e1734ff859299d7b10626a644
10+
refs/heads/dist-snap: 9258053b5cce6dc752d57df2e0af14a335dfe7a4
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/dist-snap/src/libcore/dlist.rs

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -18,28 +18,11 @@ enum dlist_node<T> = @{
1818
mut next: dlist_link<T>
1919
};
2020

21-
class dlist_root<T> {
22-
let mut size: uint;
23-
let mut hd: dlist_link<T>;
24-
let mut tl: dlist_link<T>;
25-
new() {
26-
self.size = 0; self.hd = none; self.tl = none;
27-
}
28-
drop {
29-
/* FIXME (#3039) This doesn't work during task failure - the box
30-
* annihilator might have killed some of our nodes already. This will
31-
* be safe to uncomment when the box annihilator is safer. As is,
32-
* this makes test_dlist_cyclic_link below crash the runtime.
33-
// Empty the list. Not doing this explicitly would leave cyclic links
34-
// around, not to be freed until cycle collection at task exit.
35-
while self.hd.is_some() {
36-
self.unlink(self.hd.get());
37-
}
38-
*/
39-
}
40-
}
41-
42-
type dlist<T> = @dlist_root<T>;
21+
enum dlist<T> = @{
22+
mut size: uint,
23+
mut hd: dlist_link<T>,
24+
mut tl: dlist_link<T>,
25+
};
4326

4427
impl private_methods<T> for dlist_node<T> {
4528
pure fn assert_links() {
@@ -107,7 +90,7 @@ pure fn new_dlist_node<T>(+data: T) -> dlist_node<T> {
10790

10891
/// Creates a new, empty dlist.
10992
pure fn new_dlist<T>() -> dlist<T> {
110-
@unchecked { dlist_root() }
93+
dlist(@{mut size: 0, mut hd: none, mut tl: none})
11194
}
11295

11396
/// Creates a new dlist with a single element
@@ -134,7 +117,7 @@ fn concat<T>(lists: dlist<dlist<T>>) -> dlist<T> {
134117
result
135118
}
136119

137-
impl private_methods<T> for dlist_root<T> {
120+
impl private_methods<T> for dlist<T> {
138121
pure fn new_link(-data: T) -> dlist_link<T> {
139122
some(dlist_node(@{data: data, mut linked: true,
140123
mut prev: none, mut next: none}))
@@ -336,7 +319,7 @@ impl extensions<T> for dlist<T> {
336319
* to the other list's head. O(1).
337320
*/
338321
fn append(them: dlist<T>) {
339-
if box::ptr_eq(self, them) {
322+
if box::ptr_eq(*self, *them) {
340323
fail ~"Cannot append a dlist to itself!"
341324
}
342325
if them.len() > 0 {
@@ -353,7 +336,7 @@ impl extensions<T> for dlist<T> {
353336
* list's tail to this list's head. O(1).
354337
*/
355338
fn prepend(them: dlist<T>) {
356-
if box::ptr_eq(self, them) {
339+
if box::ptr_eq(*self, *them) {
357340
fail ~"Cannot prepend a dlist to itself!"
358341
}
359342
if them.len() > 0 {

0 commit comments

Comments
 (0)