Skip to content

Commit

Permalink
moved collections from libextra into libcollections
Browse files Browse the repository at this point in the history
  • Loading branch information
HeroesGrave committed Feb 7, 2014
1 parent 87fe3cc commit d81bb44
Show file tree
Hide file tree
Showing 36 changed files with 117 additions and 72 deletions.
14 changes: 8 additions & 6 deletions mk/crates.mk
Original file line number Diff line number Diff line change
Expand Up @@ -50,28 +50,30 @@
################################################################################

TARGET_CRATES := std extra green rustuv native flate arena glob term semver \
uuid serialize sync getopts
uuid serialize sync getopts collections
HOST_CRATES := syntax rustc rustdoc
CRATES := $(TARGET_CRATES) $(HOST_CRATES)
TOOLS := compiletest rustdoc rustc

DEPS_std := native:rustrt
DEPS_extra := std term sync serialize getopts
DEPS_extra := std term sync serialize getopts collections
DEPS_green := std
DEPS_rustuv := std native:uv native:uv_support
DEPS_native := std
DEPS_syntax := std extra term serialize
DEPS_rustc := syntax native:rustllvm flate arena serialize sync getopts
DEPS_rustdoc := rustc native:sundown serialize sync getopts
DEPS_syntax := std extra term serialize collections
DEPS_rustc := syntax native:rustllvm flate arena serialize sync getopts \
collections
DEPS_rustdoc := rustc native:sundown serialize sync getopts collections
DEPS_flate := std native:miniz
DEPS_arena := std extra
DEPS_arena := std collections
DEPS_glob := std
DEPS_serialize := std
DEPS_term := std
DEPS_semver := std
DEPS_uuid := std serialize
DEPS_sync := std
DEPS_getopts := std
DEPS_collections := std serialize

TOOL_DEPS_compiletest := extra green rustuv getopts
TOOL_DEPS_rustdoc := rustdoc green rustuv
Expand Down
1 change: 1 addition & 0 deletions src/doc/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ li {list-style-type: none; }
* [The Rust compiler, `librustc`](rustc/index.html)

* [The `arena` allocation library](arena/index.html)
* [The `collections` library](collections/index.html)
* [The `flate` compression library](flate/index.html)
* [The `getopts` argument parsing library](getopts/index.html)
* [The `glob` file path matching library](glob/index.html)
Expand Down
2 changes: 1 addition & 1 deletion src/doc/rust.md
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@ use foo::baz::foobaz; // good: foo is at the root of the crate
mod foo {
extern mod extra;
use foo::extra::list; // good: foo is at crate root
use foo::extra::time; // good: foo is at crate root
// use extra::*; // bad: extra is not at the crate root
use self::baz::foobaz; // good: self refers to module 'foo'
use foo::bar::foobar; // good: foo is at crate root
Expand Down
8 changes: 5 additions & 3 deletions src/libarena/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@
#[allow(missing_doc)];
#[feature(managed_boxes)];

extern mod extra;
extern mod collections;

use extra::list::{List, Cons, Nil};
use extra::list;
#[cfg(test)] extern mod extra;

use collections::list::{List, Cons, Nil};
use collections::list;

use std::cast::{transmute, transmute_mut, transmute_mut_region};
use std::cast;
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/libextra/container.rs → src/libcollections/deque.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pub mod bench {
use std::container::MutableMap;
use std::{vec, rand};
use std::rand::Rng;
use test::BenchHarness;
use extra::test::BenchHarness;

pub fn insert_rand_n<M:MutableMap<uint,uint>>(n: uint,
map: &mut M,
Expand Down
4 changes: 2 additions & 2 deletions src/libextra/dlist.rs → src/libcollections/dlist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use std::util;
use std::iter::Rev;
use std::iter;

use container::Deque;
use deque::Deque;

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

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

#[cfg(test)]
mod tests {
use container::Deque;
use deque::Deque;
use extra::test;
use std::rand;
use super::{DList, Node, ListInsertion};
Expand Down
46 changes: 46 additions & 0 deletions src/libcollections/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

/*!
* Collection types.
*/

#[crate_id = "collections#0.10-pre"];
#[crate_type = "rlib"];
#[crate_type = "dylib"];
#[license = "MIT/ASL2"];

#[feature(macro_rules, managed_boxes)];

#[cfg(test)] extern mod extra;

extern mod serialize;

pub use bitv::Bitv;
pub use btree::BTree;
pub use deque::Deque;
pub use dlist::DList;
pub use list::List;
pub use lru_cache::LruCache;
pub use priority_queue::PriorityQueue;
pub use ringbuf::RingBuf;
pub use smallintmap::SmallIntMap;
pub use treemap::{TreeMap, TreeSet};

pub mod bitv;
pub mod btree;
pub mod deque;
pub mod dlist;
pub mod list;
pub mod lru_cache;
pub mod priority_queue;
pub mod ringbuf;
pub mod smallintmap;
pub mod treemap;
2 changes: 1 addition & 1 deletion src/libextra/list.rs → src/libcollections/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ pub fn each<T>(l: @List<T>, f: |&T| -> bool) -> bool {

#[cfg(test)]
mod tests {
use list::*;
use list::{List, Nil, from_vec, head, is_empty, tail};
use list;

use std::option;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
//! # Example
//!
//! ```rust
//! use extra::lru_cache::LruCache;
//! use collections::LruCache;
//!
//! let mut cache: LruCache<int, int> = LruCache::new(2);
//! cache.put(1, 10);
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions src/libextra/ringbuf.rs → src/libcollections/ringbuf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use std::num;
use std::vec;
use std::iter::{Rev, RandomAccessIterator};

use container::Deque;
use deque::Deque;

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

Expand Down Expand Up @@ -431,7 +431,7 @@ impl<D:Decoder,T:Decodable<D>> Decodable<D> for RingBuf<T> {

#[cfg(test)]
mod tests {
use container::Deque;
use deque::Deque;
use extra::test;
use std::clone::Clone;
use std::cmp::Eq;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -471,9 +471,9 @@ mod test_map {
#[cfg(test)]
mod bench {

use super::*;
use test::BenchHarness;
use container::bench::*;
use super::SmallIntMap;
use extra::test::BenchHarness;
use deque::bench::{insert_rand_n, insert_seq_n, find_rand_n, find_seq_n};

// Find seq
#[bench]
Expand Down
8 changes: 4 additions & 4 deletions src/libextra/treemap.rs → src/libcollections/treemap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1495,9 +1495,9 @@ mod test_treemap {
#[cfg(test)]
mod bench {

use super::*;
use test::BenchHarness;
use container::bench::*;
use super::TreeMap;
use extra::test::BenchHarness;
use deque::bench::{insert_rand_n, insert_seq_n, find_rand_n, find_seq_n};

// Find seq
#[bench]
Expand Down Expand Up @@ -1555,7 +1555,7 @@ mod bench {
#[cfg(test)]
mod test_set {

use super::*;
use super::{TreeMap, TreeSet};

#[test]
fn test_clear() {
Expand Down
12 changes: 8 additions & 4 deletions src/libextra/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,11 @@ A basic `ToJson` example using a TreeMap of attribute name / attribute value:
```rust
extern mod collections;
use extra::json;
use extra::json::ToJson;
use extra::treemap::TreeMap;
use collections::TreeMap;
pub struct MyStruct {
attr1: u8,
Expand Down Expand Up @@ -185,10 +187,12 @@ Example of `ToJson` trait implementation for TestStruct1.
```rust
extern mod serialize;
extern mod collections;
use extra::json;
use extra::json::ToJson;
use serialize::{Encodable, Decodable};
use extra::treemap::TreeMap;
use collections::TreeMap;
#[deriving(Decodable, Encodable)] // generate Decodable, Encodable impl.
pub struct TestStruct1 {
Expand Down Expand Up @@ -236,7 +240,7 @@ use std::to_str;

use serialize::Encodable;
use serialize;
use treemap::TreeMap;
use collections::TreeMap;

macro_rules! if_ok( ($e:expr) => (
match $e { Ok(e) => e, Err(e) => { self.error = Err(e); return } }
Expand Down Expand Up @@ -1588,7 +1592,7 @@ mod tests {

use std::io;
use serialize::{Encodable, Decodable};
use treemap::TreeMap;
use collections::TreeMap;

#[deriving(Eq, Encodable, Decodable)]
enum Animal {
Expand Down
21 changes: 2 additions & 19 deletions src/libextra/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ extern mod sync;
#[cfg(not(stage0))]
extern mod serialize;

extern mod collections;

#[cfg(stage0)]
pub mod serialize {
#[allow(missing_doc)];
Expand All @@ -47,29 +49,10 @@ pub mod serialize {
EncoderHelpers, DecoderHelpers};
}

#[cfg(stage0)]
macro_rules! if_ok (
($e:expr) => (match $e { Ok(e) => e, Err(e) => return Err(e) })
)

// Utility modules

pub mod c_vec;

// Collections

pub mod container;
pub mod bitv;
pub mod list;
pub mod ringbuf;
pub mod priority_queue;
pub mod smallintmap;

pub mod dlist;
pub mod treemap;
pub mod btree;
pub mod lru_cache;

// And ... other stuff

pub mod url;
Expand Down
2 changes: 1 addition & 1 deletion src/libextra/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use serialize::Decodable;
use stats::Stats;
use stats;
use time::precise_time_ns;
use treemap::TreeMap;
use collections::TreeMap;

use std::clone::Clone;
use std::io;
Expand Down
2 changes: 1 addition & 1 deletion src/libextra/workcache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use json;
use json::ToJson;
use serialize::{Encoder, Encodable, Decoder, Decodable};
use sync::{Arc,RWArc};
use treemap::TreeMap;
use collections::TreeMap;
use std::str;
use std::io;
use std::io::{File, MemWriter};
Expand Down
1 change: 1 addition & 0 deletions src/librustc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ extern mod syntax;
extern mod serialize;
extern mod sync;
extern mod getopts;
extern mod collections;

use back::link;
use driver::session;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ use std::u16;
use std::u32;
use std::u64;
use std::u8;
use extra::smallintmap::SmallIntMap;
use collections::SmallIntMap;
use syntax::ast_map;
use syntax::ast_util::IdVisitingOperation;
use syntax::attr::{AttrMetaMethods, AttributeMethods};
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/typeck/infer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub use middle::typeck::infer::resolve::{resolve_ivar, resolve_all};
pub use middle::typeck::infer::resolve::{resolve_nested_tvar};
pub use middle::typeck::infer::resolve::{resolve_rvar};

use extra::smallintmap::SmallIntMap;
use collections::SmallIntMap;
use middle::ty::{TyVid, IntVid, FloatVid, RegionVid, Vid};
use middle::ty;
use middle::ty_fold;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/typeck/infer/unify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// except according to those terms.


use extra::smallintmap::SmallIntMap;
use collections::SmallIntMap;

use middle::ty::{Vid, expected_found, IntVarValue};
use middle::ty;
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/typeck/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ use util::ppaux;
use std::cell::RefCell;
use std::hashmap::HashMap;
use std::rc::Rc;
use extra::list::List;
use extra::list;
use collections::List;
use collections::list;
use syntax::codemap::Span;
use syntax::print::pprust::*;
use syntax::{ast, ast_map, abi};
Expand Down
3 changes: 2 additions & 1 deletion src/librustdoc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ extern mod extra;
extern mod serialize;
extern mod sync;
extern mod getopts;
extern mod collections;

use std::local_data;
use std::io;
Expand Down Expand Up @@ -326,7 +327,7 @@ fn json_output(crate: clean::Crate, res: ~[plugins::PluginJson],
// "crate": { parsed crate ... },
// "plugins": { output of plugins ... }
// }
let mut json = ~extra::treemap::TreeMap::new();
let mut json = ~collections::TreeMap::new();
json.insert(~"schema", json::String(SCHEMA_VERSION.to_owned()));
let plugins_json = ~res.move_iter().filter_map(|opt| opt).collect();

Expand Down
2 changes: 1 addition & 1 deletion src/libsyntax/ast_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use util::small_vector::SmallVector;

use std::logging;
use std::cell::RefCell;
use extra::smallintmap::SmallIntMap;
use collections::SmallIntMap;

#[deriving(Clone, Eq)]
pub enum PathElem {
Expand Down
1 change: 1 addition & 0 deletions src/libsyntax/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ This API is completely unstable and subject to change.
extern mod extra;
extern mod serialize;
extern mod term;
extern mod collections;

pub mod util {
pub mod interner;
Expand Down
Loading

5 comments on commit d81bb44

@bors
Copy link
Contributor

@bors bors commented on d81bb44 Feb 7, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on d81bb44 Feb 7, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging HeroesGrave/rust/libcollection = d81bb44 into auto

@bors
Copy link
Contributor

@bors bors commented on d81bb44 Feb 7, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HeroesGrave/rust/libcollection = d81bb44 merged ok, testing candidate = 21b856d

@bors
Copy link
Contributor

@bors bors commented on d81bb44 Feb 7, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on d81bb44 Feb 7, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 21b856d

Please sign in to comment.