Skip to content

Commit 21b856d

Browse files
committed
auto merge of #12010 : HeroesGrave/rust/libcollection, r=alexcrichton
Part of #8784 Changes: - Everything labeled under collections in libextra has been moved into a new crate 'libcollection'. - Renamed container.rs to deque.rs, since it was no longer 'container traits for extra', just a deque trait. - Crates that depend on the collections have been updated and dependencies sorted. - I think I changed all the imports in the tests to make sure it works. I'm not entirely sure, as near the end of the tests there was yet another `use` that I forgot to change, and when I went to try again, it started rebuilding everything, which I don't currently have time for. There will probably be incompatibility between this and the other pull requests that are splitting up libextra. I'm happy to rebase once those have been merged. The tests I didn't get to run should pass. But I can redo them another time if they don't.
2 parents 55f53f5 + d81bb44 commit 21b856d

36 files changed

+117
-72
lines changed

mk/crates.mk

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,28 +50,30 @@
5050
################################################################################
5151

5252
TARGET_CRATES := std extra green rustuv native flate arena glob term semver \
53-
uuid serialize sync getopts
53+
uuid serialize sync getopts collections
5454
HOST_CRATES := syntax rustc rustdoc
5555
CRATES := $(TARGET_CRATES) $(HOST_CRATES)
5656
TOOLS := compiletest rustdoc rustc
5757

5858
DEPS_std := native:rustrt
59-
DEPS_extra := std term sync serialize getopts
59+
DEPS_extra := std term sync serialize getopts collections
6060
DEPS_green := std
6161
DEPS_rustuv := std native:uv native:uv_support
6262
DEPS_native := std
63-
DEPS_syntax := std extra term serialize
64-
DEPS_rustc := syntax native:rustllvm flate arena serialize sync getopts
65-
DEPS_rustdoc := rustc native:sundown serialize sync getopts
63+
DEPS_syntax := std extra term serialize collections
64+
DEPS_rustc := syntax native:rustllvm flate arena serialize sync getopts \
65+
collections
66+
DEPS_rustdoc := rustc native:sundown serialize sync getopts collections
6667
DEPS_flate := std native:miniz
67-
DEPS_arena := std extra
68+
DEPS_arena := std collections
6869
DEPS_glob := std
6970
DEPS_serialize := std
7071
DEPS_term := std
7172
DEPS_semver := std
7273
DEPS_uuid := std serialize
7374
DEPS_sync := std
7475
DEPS_getopts := std
76+
DEPS_collections := std serialize
7577

7678
TOOL_DEPS_compiletest := extra green rustuv getopts
7779
TOOL_DEPS_rustdoc := rustdoc green rustuv

src/doc/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ li {list-style-type: none; }
3838
* [The Rust compiler, `librustc`](rustc/index.html)
3939

4040
* [The `arena` allocation library](arena/index.html)
41+
* [The `collections` library](collections/index.html)
4142
* [The `flate` compression library](flate/index.html)
4243
* [The `getopts` argument parsing library](getopts/index.html)
4344
* [The `glob` file path matching library](glob/index.html)

src/doc/rust.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,7 @@ use foo::baz::foobaz; // good: foo is at the root of the crate
881881
mod foo {
882882
extern mod extra;
883883
884-
use foo::extra::list; // good: foo is at crate root
884+
use foo::extra::time; // good: foo is at crate root
885885
// use extra::*; // bad: extra is not at the crate root
886886
use self::baz::foobaz; // good: self refers to module 'foo'
887887
use foo::bar::foobar; // good: foo is at crate root

src/libarena/lib.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@
2222
#[allow(missing_doc)];
2323
#[feature(managed_boxes)];
2424

25-
extern mod extra;
25+
extern mod collections;
2626

27-
use extra::list::{List, Cons, Nil};
28-
use extra::list;
27+
#[cfg(test)] extern mod extra;
28+
29+
use collections::list::{List, Cons, Nil};
30+
use collections::list;
2931

3032
use std::cast::{transmute, transmute_mut, transmute_mut_region};
3133
use std::cast;
File renamed without changes.
File renamed without changes.

src/libextra/container.rs renamed to src/libcollections/deque.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ pub mod bench {
4444
use std::container::MutableMap;
4545
use std::{vec, rand};
4646
use std::rand::Rng;
47-
use test::BenchHarness;
47+
use extra::test::BenchHarness;
4848

4949
pub fn insert_rand_n<M:MutableMap<uint,uint>>(n: uint,
5050
map: &mut M,

src/libextra/dlist.rs renamed to src/libcollections/dlist.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use std::util;
2828
use std::iter::Rev;
2929
use std::iter;
3030

31-
use container::Deque;
31+
use deque::Deque;
3232

3333
use serialize::{Encodable, Decodable, Encoder, Decoder};
3434

@@ -657,7 +657,7 @@ impl<D:Decoder,T:Decodable<D>> Decodable<D> for DList<T> {
657657

658658
#[cfg(test)]
659659
mod tests {
660-
use container::Deque;
660+
use deque::Deque;
661661
use extra::test;
662662
use std::rand;
663663
use super::{DList, Node, ListInsertion};

src/libcollections/lib.rs

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
/*!
12+
* Collection types.
13+
*/
14+
15+
#[crate_id = "collections#0.10-pre"];
16+
#[crate_type = "rlib"];
17+
#[crate_type = "dylib"];
18+
#[license = "MIT/ASL2"];
19+
20+
#[feature(macro_rules, managed_boxes)];
21+
22+
#[cfg(test)] extern mod extra;
23+
24+
extern mod serialize;
25+
26+
pub use bitv::Bitv;
27+
pub use btree::BTree;
28+
pub use deque::Deque;
29+
pub use dlist::DList;
30+
pub use list::List;
31+
pub use lru_cache::LruCache;
32+
pub use priority_queue::PriorityQueue;
33+
pub use ringbuf::RingBuf;
34+
pub use smallintmap::SmallIntMap;
35+
pub use treemap::{TreeMap, TreeSet};
36+
37+
pub mod bitv;
38+
pub mod btree;
39+
pub mod deque;
40+
pub mod dlist;
41+
pub mod list;
42+
pub mod lru_cache;
43+
pub mod priority_queue;
44+
pub mod ringbuf;
45+
pub mod smallintmap;
46+
pub mod treemap;

src/libextra/list.rs renamed to src/libcollections/list.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ pub fn each<T>(l: @List<T>, f: |&T| -> bool) -> bool {
153153

154154
#[cfg(test)]
155155
mod tests {
156-
use list::*;
156+
use list::{List, Nil, from_vec, head, is_empty, tail};
157157
use list;
158158

159159
use std::option;

0 commit comments

Comments
 (0)