From 4d0d3da9e4d16bdbf509837b4f981db39328cfe0 Mon Sep 17 00:00:00 2001 From: David Manescu Date: Wed, 29 Jan 2014 13:50:05 +1100 Subject: [PATCH] extra: move arena to libarena In line with the dissolution of libextra - #8784 - moves arena to its own library libarena. Changes based on PR #11787. Updates .gitignore to ignore doc/arena. --- .gitignore | 1 + doc/index.md | 1 + mk/crates.mk | 5 +++-- src/{libextra/arena.rs => libarena/lib.rs} | 13 ++++++++++--- src/libextra/lib.rs | 1 - src/librustc/lib.rs | 1 + src/librustc/middle/trans/base.rs | 2 +- src/librustc/middle/trans/common.rs | 2 +- src/librustc/middle/typeck/variance.rs | 4 ++-- src/test/bench/shootout-binarytrees.rs | 3 ++- src/test/run-pass/placement-new-arena.rs | 4 ++-- src/test/run-pass/regions-mock-tcx.rs | 5 ++--- 12 files changed, 26 insertions(+), 16 deletions(-) rename src/{libextra/arena.rs => libarena/lib.rs} (98%) diff --git a/.gitignore b/.gitignore index f7f1d31ef48..cc4f185bafd 100644 --- a/.gitignore +++ b/.gitignore @@ -74,6 +74,7 @@ src/.DS_Store /doc/html /doc/latex /doc/std +/doc/arena /doc/extra /doc/flate /doc/green diff --git a/doc/index.md b/doc/index.md index 16c6db3859c..bfd81a1d85f 100644 --- a/doc/index.md +++ b/doc/index.md @@ -37,6 +37,7 @@ li {list-style-type: none; } * [The Rust parser, `libsyntax`](syntax/index.html) * [The Rust compiler, `librustc`](rustc/index.html) +* [The `arena` allocation library](arena/index.html) * [The `flate` compression library](flate/index.html) # Tooling diff --git a/mk/crates.mk b/mk/crates.mk index dc374549dad..c865a37b8ec 100644 --- a/mk/crates.mk +++ b/mk/crates.mk @@ -49,7 +49,7 @@ # automatically generated for all stage/host/target combinations. ################################################################################ -TARGET_CRATES := std extra green rustuv native flate +TARGET_CRATES := std extra green rustuv native flate arena HOST_CRATES := syntax rustc rustdoc rustpkg CRATES := $(TARGET_CRATES) $(HOST_CRATES) TOOLS := compiletest rustpkg rustdoc rustc @@ -60,10 +60,11 @@ DEPS_green := std DEPS_rustuv := std native:uv native:uv_support DEPS_native := std DEPS_syntax := std extra -DEPS_rustc := syntax native:rustllvm flate +DEPS_rustc := syntax native:rustllvm flate arena DEPS_rustdoc := rustc native:sundown DEPS_rustpkg := rustc DEPS_flate := std native:miniz +DEPS_arena := std extra TOOL_DEPS_compiletest := extra green rustuv TOOL_DEPS_rustpkg := rustpkg green rustuv diff --git a/src/libextra/arena.rs b/src/libarena/lib.rs similarity index 98% rename from src/libextra/arena.rs rename to src/libarena/lib.rs index 87f6e27b632..27dad55c429 100644 --- a/src/libextra/arena.rs +++ b/src/libarena/lib.rs @@ -15,10 +15,17 @@ //! of individual objects while the arena itself is still alive. The benefit //! of an arena is very fast allocation; just a pointer bump. +#[crate_id = "arena#0.10-pre"]; +#[crate_type = "rlib"]; +#[crate_type = "dylib"]; +#[license = "MIT/ASL2"]; #[allow(missing_doc)]; +#[feature(managed_boxes)]; -use list::{List, Cons, Nil}; -use list; +extern mod extra; + +use extra::list::{List, Cons, Nil}; +use extra::list; use std::at_vec; use std::cast::{transmute, transmute_mut, transmute_mut_region}; @@ -493,7 +500,7 @@ impl Drop for TypedArena { #[cfg(test)] mod test { use super::{Arena, TypedArena}; - use test::BenchHarness; + use extra::test::BenchHarness; struct Point { x: int, diff --git a/src/libextra/lib.rs b/src/libextra/lib.rs index 5a4fedd2b2a..6e3f5fd4b95 100644 --- a/src/libextra/lib.rs +++ b/src/libextra/lib.rs @@ -70,7 +70,6 @@ pub mod tempfile; pub mod glob; pub mod term; pub mod time; -pub mod arena; pub mod base64; pub mod workcache; pub mod enum_set; diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs index 9056d6e5d4f..c840faecb55 100644 --- a/src/librustc/lib.rs +++ b/src/librustc/lib.rs @@ -31,6 +31,7 @@ This API is completely unstable and subject to change. extern mod extra; extern mod flate; +extern mod arena; extern mod syntax; use back::link; diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs index 87667d3ff48..44349cc892b 100644 --- a/src/librustc/middle/trans/base.rs +++ b/src/librustc/middle/trans/base.rs @@ -68,7 +68,7 @@ use util::common::indenter; use util::ppaux::{Repr, ty_to_str}; use util::sha2::Sha256; -use extra::arena::TypedArena; +use arena::TypedArena; use extra::time; use std::c_str::ToCStr; use std::cell::{Cell, RefCell}; diff --git a/src/librustc/middle/trans/common.rs b/src/librustc/middle/trans/common.rs index 38badc20c19..18a6727dee0 100644 --- a/src/librustc/middle/trans/common.rs +++ b/src/librustc/middle/trans/common.rs @@ -31,7 +31,7 @@ use middle::typeck; use util::ppaux::Repr; -use extra::arena::TypedArena; +use arena::TypedArena; use std::c_str::ToCStr; use std::cast::transmute; use std::cast; diff --git a/src/librustc/middle/typeck/variance.rs b/src/librustc/middle/typeck/variance.rs index c2608967313..dc57ad747eb 100644 --- a/src/librustc/middle/typeck/variance.rs +++ b/src/librustc/middle/typeck/variance.rs @@ -193,8 +193,8 @@ represents the "variance transform" as defined in the paper: */ use std::hashmap::HashMap; -use extra::arena; -use extra::arena::Arena; +use arena; +use arena::Arena; use middle::ty; use std::vec; use syntax::ast; diff --git a/src/test/bench/shootout-binarytrees.rs b/src/test/bench/shootout-binarytrees.rs index 7abbbdd278c..5b0a90f280d 100644 --- a/src/test/bench/shootout-binarytrees.rs +++ b/src/test/bench/shootout-binarytrees.rs @@ -9,10 +9,11 @@ // except according to those terms. extern mod extra; +extern mod arena; use std::iter::range_step; use extra::future::Future; -use extra::arena::TypedArena; +use arena::TypedArena; enum Tree<'a> { Nil, diff --git a/src/test/run-pass/placement-new-arena.rs b/src/test/run-pass/placement-new-arena.rs index 238ea7485c9..3e26dc69a84 100644 --- a/src/test/run-pass/placement-new-arena.rs +++ b/src/test/run-pass/placement-new-arena.rs @@ -10,8 +10,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -extern mod extra; -use extra::arena::Arena; +extern mod arena; +use arena::Arena; pub fn main() { let mut arena = Arena::new(); diff --git a/src/test/run-pass/regions-mock-tcx.rs b/src/test/run-pass/regions-mock-tcx.rs index 71b9e3ee7ba..3b5893358bf 100644 --- a/src/test/run-pass/regions-mock-tcx.rs +++ b/src/test/run-pass/regions-mock-tcx.rs @@ -16,10 +16,9 @@ // - Multiple lifetime parameters // - Arenas -extern mod extra; +extern mod arena; -use extra::arena; -use extra::arena::Arena; +use arena::Arena; use std::hashmap::HashMap; use std::cast; use std::libc;