Skip to content

Commit bd7ba1f

Browse files
committed
auto merge of #5634 : thestinger/rust/dlist, r=brson,thestinger
Closes #3549 The issue report has some reasoning, but I'd like to add that I don't think managed pointers belong in core. It's *possible* to write a safe doubly-linked list on top of `unsafe`, but it would be much more limited and I don't think there's much of a use case - it would lose a lot of flexibility. You're probably better off using a vector, hash table, tree, heap or ring buffer in almost every case.
2 parents 8e30d3f + 258a367 commit bd7ba1f

File tree

4 files changed

+6
-12
lines changed

4 files changed

+6
-12
lines changed

src/libcore/core.rc

-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,6 @@ pub mod container;
189189
pub mod option;
190190
pub mod result;
191191
pub mod either;
192-
pub mod dlist;
193192
pub mod hashmap;
194193
pub mod cell;
195194
pub mod trie;

src/libcore/dlist.rs renamed to src/libstd/dlist.rs

+4-10
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,8 @@ Do not use ==, !=, <, etc on doubly-linked lists -- it may not terminate.
1818
1919
*/
2020

21-
use iter;
22-
use iter::BaseIter;
23-
use kinds::Copy;
24-
use managed;
25-
use option::{None, Option, Some};
26-
use vec;
21+
use core::prelude::*;
22+
use core::managed;
2723

2824
pub type DListLink<T> = Option<@mut DListNode<T>>;
2925

@@ -540,10 +536,8 @@ impl<T> BaseIter<T> for @mut DList<T> {
540536

541537
#[cfg(test)]
542538
mod tests {
543-
use dlist::{DList, concat, from_vec, new_dlist_node};
544-
use iter;
545-
use option::{None, Some};
546-
use vec;
539+
use super::*;
540+
use core::prelude::*;
547541

548542
#[test]
549543
pub fn test_dlist_concat() {

src/libstd/serialize.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ Core encoding and decoding interfaces.
1717
#[forbid(non_camel_case_types)];
1818

1919
use core::prelude::*;
20-
use core::dlist::DList;
2120
use core::hashmap::linear::{LinearMap, LinearSet};
2221
use core::trie::{TrieMap, TrieSet};
2322
use deque::Deque;
23+
use dlist::DList;
2424
use treemap::{TreeMap, TreeSet};
2525

2626
pub trait Encoder {

src/libstd/std.rc

+1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ pub mod priority_queue;
7575
pub mod rope;
7676
pub mod smallintmap;
7777
pub mod sort;
78+
pub mod dlist;
7879
pub mod treemap;
7980

8081
// And ... other stuff

0 commit comments

Comments
 (0)