auto merge of #12896 : alexcrichton/rust/goodbye-extra, r=brson

This commit shreds all remnants of libextra from the compiler and standard
distribution. Two modules, c_vec/tempfile, were moved into libstd after some
cleanup, and the other modules were moved to separate crates as seen fit.

Closes #8784
Closes #12413
Closes #12576
This commit is contained in:
bors 2014-03-14 23:11:31 -07:00
commit fc7a112808
158 changed files with 315 additions and 873 deletions

View File

@ -37,7 +37,7 @@
#
# DEPS_<crate>
# These lists are the dependencies of the <crate> that is to be built.
# Rust dependencies are listed bare (i.e. std, extra, green) and native
# Rust dependencies are listed bare (i.e. std, green) and native
# dependencies have a "native:" prefix (i.e. native:sundown). All deps
# will be built before the crate itself is built.
#
@ -49,23 +49,23 @@
# automatically generated for all stage/host/target combinations.
################################################################################
TARGET_CRATES := std extra green rustuv native flate arena glob term semver \
uuid serialize sync getopts collections num test time rand
TARGET_CRATES := std green rustuv native flate arena glob term semver \
uuid serialize sync getopts collections num test time rand \
workcache url
HOST_CRATES := syntax rustc rustdoc fourcc hexfloat
CRATES := $(TARGET_CRATES) $(HOST_CRATES)
TOOLS := compiletest rustdoc rustc
DEPS_std := native:rustrt native:compiler-rt native:backtrace
DEPS_extra := std term sync serialize getopts collections time rand
DEPS_green := std rand native:context_switch
DEPS_rustuv := std native:uv native:uv_support
DEPS_native := std
DEPS_syntax := std term serialize collections
DEPS_rustc := syntax native:rustllvm flate arena serialize sync getopts \
collections time extra
collections time
DEPS_rustdoc := rustc native:sundown serialize sync getopts collections \
test time
DEPS_flate := std extra native:miniz
DEPS_flate := std native:miniz
DEPS_arena := std collections
DEPS_glob := std
DEPS_serialize := std collections
@ -78,9 +78,11 @@ DEPS_collections := std rand
DEPS_fourcc := syntax std
DEPS_hexfloat := syntax std
DEPS_num := std rand
DEPS_test := std extra collections getopts serialize term
DEPS_test := std collections getopts serialize term time
DEPS_time := std serialize
DEPS_rand := std
DEPS_url := std collections
DEPS_workcache := std serialize collections std
TOOL_DEPS_compiletest := test green rustuv getopts
TOOL_DEPS_rustdoc := rustdoc native

View File

@ -50,6 +50,8 @@ li {list-style-type: none; }
* [The `test` library containing the unit-testing & micro-benchmark framework](test/index.html)
* [The `time` library](time/index.html)
* [The `uuid` 128-bit universally unique identifier library](uuid/index.html)
* [The `url` library](url/index.html)
* [The `workcache` library](workcache/index.html)
# Tooling

View File

@ -787,9 +787,9 @@ Four examples of `extern crate` declarations:
~~~~ {.ignore}
extern crate pcre;
extern crate extra; // equivalent to: extern crate extra = "extra";
extern crate std; // equivalent to: extern crate std = "std";
extern crate rustextra = "extra"; // linking to 'extra' under another name
extern crate ruststd = "std"; // linking to 'std' under another name
extern crate foo = "some/where/rust-foo#foo:1.0"; // a full package ID for external tools
~~~~

View File

@ -3228,17 +3228,6 @@ See the [API documentation][stddoc] for details.
[stddoc]: std/index.html
## The extra library
Rust ships with crates such as the [extra library], an accumulation of useful things,
that are however not important enough to deserve a place in the standard
library. You can link to a library such as `extra` with an `extern crate extra;`.
[extra library]: extra/index.html
Right now `extra` contains those definitions directly, but in the future it will likely just
re-export a bunch of 'officially blessed' crates that get managed with a package manager.
# What next?
Now that you know the essentials, check out any of the additional

View File

@ -56,7 +56,6 @@ c.write(
#[feature(globs, macro_rules, struct_variant, managed_boxes)];
#[allow(warnings)];
extern crate collections;
extern crate extra;
"""
)
for t in stage2_tests:
@ -73,7 +72,6 @@ d.write(
"""
// AUTO-GENERATED FILE: DO NOT EDIT
#[feature(globs, managed_boxes)];
extern crate extra;
extern crate run_pass_stage2;
use run_pass_stage2::*;
use std::io;

View File

@ -38,7 +38,6 @@ TEMPLATE = """// Copyright {year} The Rust Project Developers. See the COPYRIGHT
// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
#[feature(struct_variant)];
extern crate extra;
extern crate rand;
{error_deriving}

View File

@ -1,240 +0,0 @@
// Copyright 2012 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.
/*!
* Library to interface with chunks of memory allocated in C.
*
* It is often desirable to safely interface with memory allocated from C,
* encapsulating the unsafety into allocation and destruction time. Indeed,
* allocating memory externally is currently the only way to give Rust shared
* mut state with C programs that keep their own references; vectors are
* unsuitable because they could be reallocated or moved at any time, and
* importing C memory into a vector takes a one-time snapshot of the memory.
*
* This module simplifies the usage of such external blocks of memory. Memory
* is encapsulated into an opaque object after creation; the lifecycle of the
* memory can be optionally managed by Rust, if an appropriate destructor
* closure is provided. Safety is ensured by bounds-checking accesses, which
* are marshalled through get and set functions.
*
* There are three unsafe functions: the two constructors, and the
* unwrap method. The constructors are unsafe for the
* obvious reason (they act on a pointer that cannot be checked inside the
* method), but `unwrap()` is somewhat more subtle in its unsafety.
* It returns the contained pointer, but at the same time destroys the CVec
* without running its destructor. This can be used to pass memory back to
* C, but care must be taken that the ownership of underlying resources are
* handled correctly, i.e. that allocated memory is eventually freed
* if necessary.
*/
use std::cast;
use std::ptr;
use std::raw;
/**
* The type representing a foreign chunk of memory
*/
pub struct CVec<T> {
priv base: *mut T,
priv len: uint,
priv rsrc: DtorRes,
}
struct DtorRes {
dtor: Option<proc()>,
}
#[unsafe_destructor]
impl Drop for DtorRes {
fn drop(&mut self) {
let dtor = self.dtor.take();
match dtor {
None => (),
Some(f) => f()
}
}
}
impl DtorRes {
fn new(dtor: Option<proc()>) -> DtorRes {
DtorRes {
dtor: dtor,
}
}
}
impl <T> CVec<T> {
/**
* Create a `CVec` from a raw pointer to a buffer with a given length.
*
* Fails if the given pointer is null.
*
* # Arguments
*
* * base - A raw pointer to a buffer
* * len - The number of elements in the buffer
*/
pub unsafe fn new(base: *mut T, len: uint) -> CVec<T> {
assert!(base != ptr::mut_null());
CVec {
base: base,
len: len,
rsrc: DtorRes::new(None)
}
}
/**
* Create a `CVec` from a foreign buffer, with a given length,
* and a function to run upon destruction.
*
* Fails if the given pointer is null.
*
* # Arguments
*
* * base - A foreign pointer to a buffer
* * len - The number of elements in the buffer
* * dtor - A proc to run when the value is destructed, useful
* for freeing the buffer, etc.
*/
pub unsafe fn new_with_dtor(base: *mut T, len: uint, dtor: proc()) -> CVec<T> {
assert!(base != ptr::mut_null());
CVec {
base: base,
len: len,
rsrc: DtorRes::new(Some(dtor))
}
}
/// View the stored data as a slice.
pub fn as_slice<'a>(&'a self) -> &'a [T] {
unsafe {
cast::transmute(raw::Slice { data: self.base as *T, len: self.len })
}
}
/// View the stored data as a mutable slice.
pub fn as_mut_slice<'a>(&'a mut self) -> &'a mut [T] {
unsafe {
cast::transmute(raw::Slice { data: self.base as *T, len: self.len })
}
}
/**
* Retrieves an element at a given index
*
* Fails if `ofs` is greater or equal to the length of the vector
*/
pub fn get<'a>(&'a self, ofs: uint) -> &'a T {
assert!(ofs < self.len);
unsafe {
&*self.base.offset(ofs as int)
}
}
/**
* Retrieves a mutable element at a given index
*
* Fails if `ofs` is greater or equal to the length of the vector
*/
pub fn get_mut<'a>(&'a mut self, ofs: uint) -> &'a mut T {
assert!(ofs < self.len);
unsafe {
&mut *self.base.offset(ofs as int)
}
}
/**
* Unwrap the pointer without running the destructor
*
* This method retrieves the underlying pointer, and in the process
* destroys the CVec but without running the destructor. A use case
* would be transferring ownership of the buffer to a C function, as
* in this case you would not want to run the destructor.
*
* Note that if you want to access the underlying pointer without
* cancelling the destructor, you can simply call `transmute` on the return
* value of `get(0)`.
*/
pub unsafe fn unwrap(mut self) -> *mut T {
self.rsrc.dtor = None;
self.base
}
}
impl <T> Container for CVec<T> {
/// Returns the length of the vector
fn len(&self) -> uint { self.len }
}
#[cfg(test)]
mod tests {
use super::*;
use std::libc::*;
use std::libc;
use std::ptr;
use std::rt::global_heap::malloc_raw;
fn malloc(n: uint) -> CVec<u8> {
unsafe {
let mem = malloc_raw(n);
CVec::new_with_dtor(mem as *mut u8, n,
proc() { libc::free(mem as *mut c_void); })
}
}
#[test]
fn test_basic() {
let mut cv = malloc(16);
*cv.get_mut(3) = 8;
*cv.get_mut(4) = 9;
assert_eq!(*cv.get(3), 8);
assert_eq!(*cv.get(4), 9);
assert_eq!(cv.len(), 16);
}
#[test]
#[should_fail]
fn test_fail_at_null() {
unsafe {
CVec::new(ptr::mut_null::<u8>(), 9);
}
}
#[test]
#[should_fail]
fn test_overrun_get() {
let cv = malloc(16);
cv.get(17);
}
#[test]
#[should_fail]
fn test_overrun_set() {
let mut cv = malloc(16);
*cv.get_mut(17) = 0;
}
#[test]
fn test_unwrap() {
unsafe {
let cv = CVec::new_with_dtor(1 as *mut int, 0,
proc() { fail!("Don't run this destructor!") });
let p = cv.unwrap();
assert_eq!(p, 1 as *mut int);
}
}
}

View File

@ -1,52 +0,0 @@
// Copyright 2012-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.
/*!
Rust extras.
The `extra` crate is a set of useful modules for a variety of
purposes, including collections, numerics, I/O, serialization,
and concurrency.
Rust extras are part of the standard Rust distribution.
*/
#[crate_id = "extra#0.10-pre"];
#[comment = "Rust extras"];
#[license = "MIT/ASL2"];
#[crate_type = "rlib"];
#[crate_type = "dylib"];
#[doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
html_root_url = "http://static.rust-lang.org/doc/master")];
#[feature(macro_rules, globs, managed_boxes, asm, default_type_params)];
#[allow(deprecated_owned_vector)];
#[deny(non_camel_case_types)];
#[deny(missing_doc)];
extern crate collections;
extern crate rand;
extern crate serialize;
extern crate sync;
extern crate time;
// Utility modules
pub mod c_vec;
pub mod url;
pub mod tempfile;
pub mod workcache;
pub mod stats;
#[cfg(unicode)]
mod unicode;

View File

@ -1,262 +0,0 @@
// Copyright 2012 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.
#[allow(missing_doc)];
pub mod icu {
pub type UBool = u8;
pub type UProperty = int;
pub type UChar32 = char;
pub static TRUE : u8 = 1u8;
pub static FALSE : u8 = 0u8;
pub static UCHAR_ALPHABETIC : UProperty = 0;
pub static UCHAR_BINARY_START : UProperty = 0; // = UCHAR_ALPHABETIC
pub static UCHAR_ASCII_HEX_DIGIT : UProperty = 1;
pub static UCHAR_BIDI_CONTROL : UProperty = 2;
pub static UCHAR_BIDI_MIRRORED : UProperty = 3;
pub static UCHAR_DASH : UProperty = 4;
pub static UCHAR_DEFAULT_IGNORABLE_CODE_POINT : UProperty = 5;
pub static UCHAR_DEPRECATED : UProperty = 6;
pub static UCHAR_DIACRITIC : UProperty = 7;
pub static UCHAR_EXTENDER : UProperty = 8;
pub static UCHAR_FULL_COMPOSITION_EXCLUSION : UProperty = 9;
pub static UCHAR_GRAPHEME_BASE : UProperty = 10;
pub static UCHAR_GRAPHEME_EXTEND : UProperty = 11;
pub static UCHAR_GRAPHEME_LINK : UProperty = 12;
pub static UCHAR_HEX_DIGIT : UProperty = 13;
pub static UCHAR_HYPHEN : UProperty = 14;
pub static UCHAR_ID_CONTINUE : UProperty = 15;
pub static UCHAR_ID_START : UProperty = 16;
pub static UCHAR_IDEOGRAPHIC : UProperty = 17;
pub static UCHAR_IDS_BINARY_OPERATOR : UProperty = 18;
pub static UCHAR_IDS_TRINARY_OPERATOR : UProperty = 19;
pub static UCHAR_JOIN_CONTROL : UProperty = 20;
pub static UCHAR_LOGICAL_ORDER_EXCEPTION : UProperty = 21;
pub static UCHAR_LOWERCASE : UProperty = 22;
pub static UCHAR_MATH : UProperty = 23;
pub static UCHAR_NONCHARACTER_CODE_POINT : UProperty = 24;
pub static UCHAR_QUOTATION_MARK : UProperty = 25;
pub static UCHAR_RADICAL : UProperty = 26;
pub static UCHAR_SOFT_DOTTED : UProperty = 27;
pub static UCHAR_TERMINAL_PUNCTUATION : UProperty = 28;
pub static UCHAR_UNIFIED_IDEOGRAPH : UProperty = 29;
pub static UCHAR_UPPERCASE : UProperty = 30;
pub static UCHAR_WHITE_SPACE : UProperty = 31;
pub static UCHAR_XID_CONTINUE : UProperty = 32;
pub static UCHAR_XID_START : UProperty = 33;
pub static UCHAR_CASE_SENSITIVE : UProperty = 34;
pub static UCHAR_S_TERM : UProperty = 35;
pub static UCHAR_VARIATION_SELECTOR : UProperty = 36;
pub static UCHAR_NFD_INERT : UProperty = 37;
pub static UCHAR_NFKD_INERT : UProperty = 38;
pub static UCHAR_NFC_INERT : UProperty = 39;
pub static UCHAR_NFKC_INERT : UProperty = 40;
pub static UCHAR_SEGMENT_STARTER : UProperty = 41;
pub static UCHAR_PATTERN_SYNTAX : UProperty = 42;
pub static UCHAR_PATTERN_WHITE_SPACE : UProperty = 43;
pub static UCHAR_POSIX_ALNUM : UProperty = 44;
pub static UCHAR_POSIX_BLANK : UProperty = 45;
pub static UCHAR_POSIX_GRAPH : UProperty = 46;
pub static UCHAR_POSIX_PRINT : UProperty = 47;
pub static UCHAR_POSIX_XDIGIT : UProperty = 48;
pub static UCHAR_CASED : UProperty = 49;
pub static UCHAR_CASE_IGNORABLE : UProperty = 50;
pub static UCHAR_CHANGES_WHEN_LOWERCASED : UProperty = 51;
pub static UCHAR_CHANGES_WHEN_UPPERCASED : UProperty = 52;
pub static UCHAR_CHANGES_WHEN_TITLECASED : UProperty = 53;
pub static UCHAR_CHANGES_WHEN_CASEFOLDED : UProperty = 54;
pub static UCHAR_CHANGES_WHEN_CASEMAPPED : UProperty = 55;
pub static UCHAR_CHANGES_WHEN_NFKC_CASEFOLDED : UProperty = 56;
pub static UCHAR_BINARY_LIMIT : UProperty = 57;
pub static UCHAR_BIDI_CLASS : UProperty = 0x1000;
pub static UCHAR_INT_START : UProperty = 0x1000; // UCHAR_BIDI_CLASS
pub static UCHAR_BLOCK : UProperty = 0x1001;
pub static UCHAR_CANONICAL_COMBINING_CLASS : UProperty = 0x1002;
pub static UCHAR_DECOMPOSITION_TYPE : UProperty = 0x1003;
pub static UCHAR_EAST_ASIAN_WIDTH : UProperty = 0x1004;
pub static UCHAR_GENERAL_CATEGORY : UProperty = 0x1005;
pub static UCHAR_JOINING_GROUP : UProperty = 0x1006;
pub static UCHAR_JOINING_TYPE : UProperty = 0x1007;
pub static UCHAR_LINE_BREAK : UProperty = 0x1008;
pub static UCHAR_NUMERIC_TYPE : UProperty = 0x1009;
pub static UCHAR_SCRIPT : UProperty = 0x100A;
pub static UCHAR_HANGUL_SYLLABLE_TYPE : UProperty = 0x100B;
pub static UCHAR_NFD_QUICK_CHECK : UProperty = 0x100C;
pub static UCHAR_NFKD_QUICK_CHECK : UProperty = 0x100D;
pub static UCHAR_NFC_QUICK_CHECK : UProperty = 0x100E;
pub static UCHAR_NFKC_QUICK_CHECK : UProperty = 0x100F;
pub static UCHAR_LEAD_CANONICAL_COMBINING_CLASS : UProperty = 0x1010;
pub static UCHAR_TRAIL_CANONICAL_COMBINING_CLASS : UProperty = 0x1011;
pub static UCHAR_GRAPHEME_CLUSTER_BREAK : UProperty = 0x1012;
pub static UCHAR_SENTENCE_BREAK : UProperty = 0x1013;
pub static UCHAR_WORD_BREAK : UProperty = 0x1014;
pub static UCHAR_INT_LIMIT : UProperty = 0x1015;
pub static UCHAR_GENERAL_CATEGORY_MASK : UProperty = 0x2000;
pub static UCHAR_MASK_START : UProperty = 0x2000;
// = UCHAR_GENERAL_CATEGORY_MASK
pub static UCHAR_MASK_LIMIT : UProperty = 0x2001;
pub static UCHAR_NUMERIC_VALUE : UProperty = 0x3000;
pub static UCHAR_DOUBLE_START : UProperty = 0x3000;
// = UCHAR_NUMERIC_VALUE
pub static UCHAR_DOUBLE_LIMIT : UProperty = 0x3001;
pub static UCHAR_AGE : UProperty = 0x4000;
pub static UCHAR_STRING_START : UProperty = 0x4000; // = UCHAR_AGE
pub static UCHAR_BIDI_MIRRORING_GLYPH : UProperty = 0x4001;
pub static UCHAR_CASE_FOLDING : UProperty = 0x4002;
pub static UCHAR_ISO_COMMENT : UProperty = 0x4003;
pub static UCHAR_LOWERCASE_MAPPING : UProperty = 0x4004;
pub static UCHAR_NAME : UProperty = 0x4005;
pub static UCHAR_SIMPLE_CASE_FOLDING : UProperty = 0x4006;
pub static UCHAR_SIMPLE_LOWERCASE_MAPPING : UProperty = 0x4007;
pub static UCHAR_SIMPLE_TITLECASE_MAPPING : UProperty = 0x4008;
pub static UCHAR_SIMPLE_UPPERCASE_MAPPING : UProperty = 0x4009;
pub static UCHAR_TITLECASE_MAPPING : UProperty = 0x400A;
pub static UCHAR_UNICODE_1_NAME : UProperty = 0x400B;
pub static UCHAR_UPPERCASE_MAPPING : UProperty = 0x400C;
pub static UCHAR_STRING_LIMIT : UProperty = 0x400D;
pub static UCHAR_SCRIPT_EXTENSIONS : UProperty = 0x7000;
pub static UCHAR_OTHER_PROPERTY_START : UProperty = 0x7000;
// = UCHAR_SCRIPT_EXTENSIONS;
pub static UCHAR_OTHER_PROPERTY_LIMIT : UProperty = 0x7001;
pub static UCHAR_INVALID_CODE : UProperty = -1;
pub mod libicu {
use unicode::icu::*;
// #[link_name = "icuuc"]
#[link(name = "icuuc")]
extern {
pub fn u_hasBinaryProperty(c: UChar32, which: UProperty) -> UBool;
pub fn u_isdigit(c: UChar32) -> UBool;
pub fn u_islower(c: UChar32) -> UBool;
pub fn u_isspace(c: UChar32) -> UBool;
pub fn u_isupper(c: UChar32) -> UBool;
pub fn u_tolower(c: UChar32) -> UChar32;
pub fn u_toupper(c: UChar32) -> UChar32;
}
}
}
pub fn is_XID_start(c: char) -> bool {
unsafe {
return icu::libicu::u_hasBinaryProperty(c, icu::UCHAR_XID_START)
== icu::TRUE;
}
}
pub fn is_XID_continue(c: char) -> bool {
unsafe {
return icu::libicu::u_hasBinaryProperty(c, icu::UCHAR_XID_START)
== icu::TRUE;
}
}
/*
Function: is_digit
Returns true if a character is a digit.
*/
pub fn is_digit(c: char) -> bool {
unsafe {
return icu::libicu::u_isdigit(c) == icu::TRUE;
}
}
/*
Function: is_lower
Returns true if a character is a lowercase letter.
*/
pub fn is_lower(c: char) -> bool {
unsafe {
return icu::libicu::u_islower(c) == icu::TRUE;
}
}
/*
Function: is_space
Returns true if a character is space.
*/
pub fn is_space(c: char) -> bool {
unsafe {
return icu::libicu::u_isspace(c) == icu::TRUE;
}
}
/*
Function: is_upper
Returns true if a character is an uppercase letter.
*/
pub fn is_upper(c: char) -> bool {
unsafe {
return icu::libicu::u_isupper(c) == icu::TRUE;
}
}
#[cfg(test)]
mod tests {
use unicode::*;
#[test]
fn test_is_digit() {
assert!((is_digit('0')));
assert!((!is_digit('m')));
}
#[test]
fn test_is_lower() {
assert!((is_lower('m')));
assert!((!is_lower('M')));
}
#[test]
fn test_is_space() {
assert!((is_space(' ')));
assert!((!is_space('m')));
}
#[test]
fn test_is_upper() {
assert!((is_upper('M')));
assert!((!is_upper('m')));
}
}

View File

@ -18,12 +18,10 @@ Simple compression
#[crate_type = "rlib"];
#[crate_type = "dylib"];
#[license = "MIT/ASL2"];
#[allow(missing_doc)];
extern crate extra;
use std::libc::{c_void, size_t, c_int};
use std::libc;
use extra::c_vec::CVec;
use std::c_vec::CVec;
pub mod rustrt {
use std::libc::{c_int, c_void, size_t};

View File

@ -17,14 +17,13 @@ use lib::llvm::{ArchiveRef, llvm};
use std::cast;
use std::vec_ng::Vec;
use std::io::fs;
use std::io;
use std::io::{fs, TempDir};
use std::libc;
use std::os;
use std::io::process::{ProcessConfig, Process, ProcessOutput};
use std::str;
use std::raw;
use extra::tempfile::TempDir;
use syntax::abi;
pub static METADATA_FILENAME: &'static str = "rust.metadata.bin";

View File

@ -32,12 +32,10 @@ use std::os::consts::{macos, freebsd, linux, android, win32};
use std::ptr;
use std::str;
use std::io;
use std::io::Process;
use std::io::fs;
use std::io::{fs, TempDir, Process};
use std::vec_ng::Vec;
use flate;
use serialize::hex::ToHex;
use extra::tempfile::TempDir;
use syntax::abi;
use syntax::ast;
use syntax::ast_map::{PathElem, PathElems, PathName};

View File

@ -32,7 +32,6 @@ This API is completely unstable and subject to change.
#[feature(macro_rules, globs, struct_variant, managed_boxes)];
#[feature(quote, default_type_params)];
extern crate extra;
extern crate flate;
extern crate arena;
extern crate syntax;

View File

@ -19,8 +19,8 @@ use metadata::loader;
use std::cell::RefCell;
use std::vec_ng::Vec;
use std::c_vec::CVec;
use collections::HashMap;
use extra::c_vec::CVec;
use syntax::ast;
use syntax::parse::token::IdentInterner;
use syntax::crateid::CrateId;

View File

@ -19,7 +19,6 @@
extern crate syntax;
extern crate rustc;
extern crate extra;
extern crate serialize;
extern crate sync;
extern crate getopts;

View File

@ -11,14 +11,13 @@
use std::cell::RefCell;
use std::char;
use std::io;
use std::io::Process;
use std::io::{Process, TempDir};
use std::local_data;
use std::os;
use std::str;
use collections::HashSet;
use testing;
use extra::tempfile::TempDir;
use rustc::back::link;
use rustc::driver::driver;
use rustc::driver::session;
@ -178,9 +177,6 @@ fn maketest(s: &str, cratename: &str, loose_feature_gating: bool) -> ~str {
}
if !s.contains("extern crate") {
if s.contains("extra") {
prog.push_str("extern crate extra;\n");
}
if s.contains(cratename) {
prog.push_str(format!("extern crate {};\n", cratename));
}

216
src/libstd/c_vec.rs Normal file
View File

@ -0,0 +1,216 @@
// Copyright 2012 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.
//! Library to interface with chunks of memory allocated in C.
//!
//! It is often desirable to safely interface with memory allocated from C,
//! encapsulating the unsafety into allocation and destruction time. Indeed,
//! allocating memory externally is currently the only way to give Rust shared
//! mut state with C programs that keep their own references; vectors are
//! unsuitable because they could be reallocated or moved at any time, and
//! importing C memory into a vector takes a one-time snapshot of the memory.
//!
//! This module simplifies the usage of such external blocks of memory. Memory
//! is encapsulated into an opaque object after creation; the lifecycle of the
//! memory can be optionally managed by Rust, if an appropriate destructor
//! closure is provided. Safety is ensured by bounds-checking accesses, which
//! are marshalled through get and set functions.
//!
//! There are three unsafe functions: the two constructors, and the
//! unwrap method. The constructors are unsafe for the
//! obvious reason (they act on a pointer that cannot be checked inside the
//! method), but `unwrap()` is somewhat more subtle in its unsafety.
//! It returns the contained pointer, but at the same time destroys the CVec
//! without running its destructor. This can be used to pass memory back to
//! C, but care must be taken that the ownership of underlying resources are
//! handled correctly, i.e. that allocated memory is eventually freed
//! if necessary.
use cast;
use container::Container;
use ptr;
use ptr::RawPtr;
use raw;
use option::{Option, Some, None};
use ops::Drop;
/// The type representing a foreign chunk of memory
pub struct CVec<T> {
priv base: *mut T,
priv len: uint,
priv dtor: Option<proc()>,
}
#[unsafe_destructor]
impl<T> Drop for CVec<T> {
fn drop(&mut self) {
match self.dtor.take() {
None => (),
Some(f) => f()
}
}
}
impl<T> CVec<T> {
/// Create a `CVec` from a raw pointer to a buffer with a given length.
///
/// Fails if the given pointer is null. The returned vector will not attempt
/// to deallocate the vector when dropped.
///
/// # Arguments
///
/// * base - A raw pointer to a buffer
/// * len - The number of elements in the buffer
pub unsafe fn new(base: *mut T, len: uint) -> CVec<T> {
assert!(base != ptr::mut_null());
CVec {
base: base,
len: len,
dtor: None,
}
}
/// Create a `CVec` from a foreign buffer, with a given length,
/// and a function to run upon destruction.
///
/// Fails if the given pointer is null.
///
/// # Arguments
///
/// * base - A foreign pointer to a buffer
/// * len - The number of elements in the buffer
/// * dtor - A proc to run when the value is destructed, useful
/// for freeing the buffer, etc.
pub unsafe fn new_with_dtor(base: *mut T, len: uint,
dtor: proc()) -> CVec<T> {
assert!(base != ptr::mut_null());
CVec {
base: base,
len: len,
dtor: Some(dtor),
}
}
/// View the stored data as a slice.
pub fn as_slice<'a>(&'a self) -> &'a [T] {
unsafe {
cast::transmute(raw::Slice { data: self.base as *T, len: self.len })
}
}
/// View the stored data as a mutable slice.
pub fn as_mut_slice<'a>(&'a mut self) -> &'a mut [T] {
unsafe {
cast::transmute(raw::Slice { data: self.base as *T, len: self.len })
}
}
/// Retrieves an element at a given index, returning `None` if the requested
/// index is greater than the length of the vector.
pub fn get<'a>(&'a self, ofs: uint) -> Option<&'a T> {
if ofs < self.len {
Some(unsafe { &*self.base.offset(ofs as int) })
} else {
None
}
}
/// Retrieves a mutable element at a given index, returning `None` if the
/// requested index is greater than the length of the vector.
pub fn get_mut<'a>(&'a mut self, ofs: uint) -> Option<&'a mut T> {
if ofs < self.len {
Some(unsafe { &mut *self.base.offset(ofs as int) })
} else {
None
}
}
/// Unwrap the pointer without running the destructor
///
/// This method retrieves the underlying pointer, and in the process
/// destroys the CVec but without running the destructor. A use case
/// would be transferring ownership of the buffer to a C function, as
/// in this case you would not want to run the destructor.
///
/// Note that if you want to access the underlying pointer without
/// cancelling the destructor, you can simply call `transmute` on the return
/// value of `get(0)`.
pub unsafe fn unwrap(mut self) -> *mut T {
self.dtor = None;
self.base
}
}
impl<T> Container for CVec<T> {
fn len(&self) -> uint { self.len }
}
#[cfg(test)]
mod tests {
use prelude::*;
use super::CVec;
use libc;
use ptr;
use rt::global_heap::malloc_raw;
fn malloc(n: uint) -> CVec<u8> {
unsafe {
let mem = malloc_raw(n);
CVec::new_with_dtor(mem as *mut u8, n,
proc() { libc::free(mem as *mut libc::c_void); })
}
}
#[test]
fn test_basic() {
let mut cv = malloc(16);
*cv.get_mut(3).unwrap() = 8;
*cv.get_mut(4).unwrap() = 9;
assert_eq!(*cv.get(3).unwrap(), 8);
assert_eq!(*cv.get(4).unwrap(), 9);
assert_eq!(cv.len(), 16);
}
#[test]
#[should_fail]
fn test_fail_at_null() {
unsafe {
CVec::new(ptr::mut_null::<u8>(), 9);
}
}
#[test]
fn test_overrun_get() {
let cv = malloc(16);
assert!(cv.get(17).is_none());
}
#[test]
fn test_overrun_set() {
let mut cv = malloc(16);
assert!(cv.get_mut(17).is_none());
}
#[test]
fn test_unwrap() {
unsafe {
let cv = CVec::new_with_dtor(1 as *mut int, 0,
proc() { fail!("Don't run this destructor!") });
let p = cv.unwrap();
assert_eq!(p, 1 as *mut int);
}
}
}

View File

@ -241,39 +241,30 @@ pub use self::net::tcp::TcpStream;
pub use self::net::udp::UdpStream;
pub use self::pipe::PipeStream;
pub use self::process::{Process, ProcessConfig};
pub use self::tempfile::TempDir;
pub use self::mem::{MemReader, BufReader, MemWriter, BufWriter};
pub use self::buffered::{BufferedReader, BufferedWriter, BufferedStream,
LineBufferedWriter};
pub use self::comm_adapters::{ChanReader, ChanWriter};
// this comes first to get the iotest! macro
pub mod test;
pub mod fs;
pub mod pipe;
pub mod process;
pub mod net;
mod mem;
pub mod stdio;
mod result;
pub mod extensions;
pub mod timer;
mod buffered;
pub mod signal;
pub mod util;
mod comm_adapters;
mod mem;
mod result;
mod tempfile;
pub mod extensions;
pub mod fs;
pub mod net;
pub mod pipe;
pub mod process;
pub mod signal;
pub mod stdio;
pub mod timer;
pub mod util;
/// The default buffer size for various I/O operations
// libuv recommends 64k buffers to maximize throughput

View File

@ -10,11 +10,16 @@
//! Temporary files and directories
use std::os;
use rand::{task_rng, Rng};
use std::io;
use std::io::fs;
use io::fs;
use io;
use iter::{Iterator, range};
use libc;
use ops::Drop;
use option::{Option, None, Some};
use os;
use path::{Path, GenericPath};
use result::{Ok, Err};
use sync::atomics;
/// A wrapper for a path to temporary directory implementing automatic
/// scope-based deletion.
@ -30,13 +35,17 @@ impl TempDir {
/// If no directory can be created, None is returned.
pub fn new_in(tmpdir: &Path, suffix: &str) -> Option<TempDir> {
if !tmpdir.is_absolute() {
let abs_tmpdir = os::make_absolute(tmpdir);
return TempDir::new_in(&abs_tmpdir, suffix);
return TempDir::new_in(&os::make_absolute(tmpdir), suffix);
}
let mut r = task_rng();
static mut CNT: atomics::AtomicUint = atomics::INIT_ATOMIC_UINT;
for _ in range(0u, 1000) {
let p = tmpdir.join(r.gen_ascii_str(16) + suffix);
let filename = format!("rs-{}-{}-{}",
unsafe { libc::getpid() },
unsafe { CNT.fetch_add(1, atomics::SeqCst) },
suffix);
let p = tmpdir.join(filename);
match fs::mkdir(&p, io::UserRWX) {
Err(..) => {}
Ok(()) => return Some(TempDir { path: Some(p) })

View File

@ -74,9 +74,8 @@
#[cfg(test)] extern crate native;
#[cfg(test)] extern crate green;
// Make extra and rand accessible for benchmarking/testcases
// Make and rand accessible for benchmarking/testcases
#[cfg(test)] extern crate rand;
#[cfg(test)] extern crate extra = "extra";
// Make std testable by not duplicating lang items. See #2912
#[cfg(test)] extern crate realstd = "std";
@ -172,6 +171,7 @@ pub mod sync;
#[unstable]
pub mod libc;
pub mod c_str;
pub mod c_vec;
pub mod os;
pub mod io;
pub mod path;

View File

@ -1392,7 +1392,6 @@ mod tests {
use rand::Rng;
use rand;
#[test]
pub fn last_os_error() {
debug!("{}", os::last_os_error());

View File

@ -4320,7 +4320,7 @@ impl Parser {
///
/// # Example
///
/// extern crate extra;
/// extern crate url;
/// extern crate foo = "bar";
fn parse_item_extern_crate(&mut self,
lo: BytePos,

View File

@ -29,19 +29,17 @@
#[crate_type = "rlib"];
#[crate_type = "dylib"];
#[feature(asm)];
#[feature(asm, macro_rules)];
#[allow(deprecated_owned_vector)];
extern crate collections;
extern crate extra;
extern crate getopts;
extern crate serialize;
extern crate term;
extern crate time;
use collections::TreeMap;
use extra::stats::Stats;
use extra::stats;
use stats::Stats;
use time::precise_time_ns;
use getopts::{OptGroup, optflag, optopt};
use serialize::{json, Decodable};
@ -68,9 +66,11 @@ pub mod test {
MetricChange, Improvement, Regression, LikelyNoise,
StaticTestFn, StaticTestName, DynTestName, DynTestFn,
run_test, test_main, test_main_static, filter_tests,
parse_opts};
parse_opts, StaticBenchFn};
}
pub mod stats;
// The name of a test. By convention this follows the rules for rust
// paths; i.e. it should be a series of identifiers separated by double
// colons. This way if some test runner wants to arrange the tests
@ -1309,7 +1309,7 @@ mod tests {
Metric, MetricMap, MetricAdded, MetricRemoved,
Improvement, Regression, LikelyNoise,
StaticTestName, DynTestName, DynTestFn};
use extra::tempfile::TempDir;
use std::io::TempDir;
#[test]
pub fn do_not_run_ignored_tests() {

View File

@ -1034,19 +1034,18 @@ mod tests {
#[cfg(test)]
mod bench {
extern crate test;
use self::test::BenchHarness;
use BenchHarness;
use std::vec;
use stats::Stats;
#[bench]
fn sum_three_items(bh: &mut BenchHarness) {
pub fn sum_three_items(bh: &mut BenchHarness) {
bh.iter(|| {
[1e20, 1.5, -1e20].sum();
})
}
#[bench]
fn sum_many_f64(bh: &mut BenchHarness) {
pub fn sum_many_f64(bh: &mut BenchHarness) {
let nums = [-1e30, 1e60, 1e30, 1.0, -1e60];
let v = vec::from_fn(500, |i| nums[i%5]);

View File

@ -10,7 +10,14 @@
//! Types/fns concerning URLs (see RFC 3986)
#[allow(missing_doc)];
#[crate_id = "url#0.10-pre"];
#[crate_type = "rlib"];
#[crate_type = "dylib"];
#[license = "MIT/ASL2"];
#[feature(default_type_params)];
#[allow(deprecated_owned_vector)];
extern crate collections;
use std::cmp::Eq;
use std::fmt;
@ -28,7 +35,7 @@ use collections::HashMap;
/// # Example
///
/// ```rust
/// use extra::url::{Url, UserInfo};
/// use url::{Url, UserInfo};
///
/// let url = Url { scheme: ~"https",
/// user: Some(UserInfo { user: ~"username", pass: None }),
@ -174,7 +181,7 @@ fn encode_inner(s: &str, full_url: bool) -> ~str {
* # Example
*
* ```rust
* use extra::url::encode;
* use url::encode;
*
* let url = encode(&"https://example.com/Rust (programming language)");
* println!("{}", url); // https://example.com/Rust%20(programming%20language)
@ -249,7 +256,7 @@ fn decode_inner(s: &str, full_url: bool) -> ~str {
* # Example
*
* ```rust
* use extra::url::decode;
* use url::decode;
*
* let url = decode(&"https://example.com/Rust%20(programming%20language)");
* println!("{}", url); // https://example.com/Rust (programming language)
@ -436,8 +443,6 @@ fn query_from_str(rawquery: &str) -> Query {
* # Example
*
* ```rust
* use extra::url;
*
* let query = ~[(~"title", ~"The Village"), (~"north", ~"52.91"), (~"west", ~"4.10")];
* println!("{}", url::query_to_str(&query)); // title=The%20Village&north=52.91&west=4.10
* ```
@ -464,7 +469,7 @@ pub fn query_to_str(query: &Query) -> ~str {
* # Example
*
* ```rust
* use extra::url::get_scheme;
* use url::get_scheme;
*
* let scheme = match get_scheme("https://example.com/") {
* Ok((sch, _)) => sch,
@ -948,8 +953,9 @@ fn test_get_path() {
#[cfg(test)]
mod tests {
use super::*;
use {encode_form_urlencoded, decode_form_urlencoded, decode_component,
decode, encode, from_str, encode_component, decode_component,
path_from_str, UserInfo, get_scheme};
use collections::HashMap;

View File

@ -8,8 +8,15 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[allow(missing_doc)];
#[allow(visible_private_types)];
#[crate_id = "workcache#0.10-pre"];
#[crate_type = "rlib"];
#[crate_type = "dylib"];
#[license = "MIT/ASL2"];
#[allow(deprecated_owned_vector, visible_private_types)];
extern crate serialize;
extern crate collections;
extern crate sync;
use serialize::json;
use serialize::json::ToJson;

View File

@ -11,8 +11,6 @@
#[crate_id="issue_2526#0.2"];
#[crate_type = "lib"];
extern crate extra;
struct arc_destruct<T> {
_data: int,
}

View File

@ -12,7 +12,6 @@
#[crate_id="req"];
#[crate_type = "lib"];
extern crate extra;
extern crate collections;
use std::cell::RefCell;

View File

@ -17,8 +17,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
extern crate extra;
use std::os;
use std::uint;

View File

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
extern crate extra;
use std::os;
use std::uint;

View File

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
extern crate extra;
use std::task::spawn;
use std::os;
use std::uint;

View File

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
extern crate extra;
use std::os;
fn ack(m: int, n: int) -> int {

View File

@ -10,8 +10,6 @@
// chameneos
extern crate extra;
use std::option;
use std::os;
use std::task;

View File

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
extern crate extra;
use std::os;
fn fib(n: int) -> int {

View File

@ -13,7 +13,6 @@
// ignore-pretty the `let to_child` line gets an extra newline
// multi tasking k-nucleotide
extern crate extra;
extern crate collections;
use std::cmp::Ord;

View File

@ -12,8 +12,6 @@
#[feature(managed_boxes)];
extern crate extra;
use std::io;
use std::io::stdio::StdReader;
use std::io::BufferedReader;

View File

@ -11,7 +11,6 @@
// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
#[feature(struct_variant)];
extern crate extra;
extern crate rand;

View File

@ -11,7 +11,6 @@
// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
#[feature(struct_variant)];
extern crate extra;
extern crate rand;

View File

@ -11,7 +11,6 @@
// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
#[feature(struct_variant)];
extern crate extra;
extern crate rand;

View File

@ -11,7 +11,6 @@
// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
#[feature(struct_variant)];
extern crate extra;
extern crate rand;

View File

@ -11,7 +11,6 @@
// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
#[feature(struct_variant)];
extern crate extra;
extern crate rand;

View File

@ -11,7 +11,6 @@
// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
#[feature(struct_variant)];
extern crate extra;
extern crate rand;

View File

@ -11,7 +11,6 @@
// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
#[feature(struct_variant)];
extern crate extra;
extern crate rand;

View File

@ -11,7 +11,6 @@
// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
#[feature(struct_variant)];
extern crate extra;
extern crate rand;

View File

@ -11,7 +11,6 @@
// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
#[feature(struct_variant)];
extern crate extra;
extern crate rand;

View File

@ -11,7 +11,6 @@
// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
#[feature(struct_variant)];
extern crate extra;
extern crate rand;

View File

@ -11,7 +11,6 @@
// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
#[feature(struct_variant)];
extern crate extra;
extern crate rand;

View File

@ -11,7 +11,6 @@
// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
#[feature(struct_variant)];
extern crate extra;
extern crate rand;

View File

@ -11,7 +11,6 @@
// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
#[feature(struct_variant)];
extern crate extra;
extern crate rand;

View File

@ -11,7 +11,6 @@
// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
#[feature(struct_variant)];
extern crate extra;
extern crate rand;

View File

@ -11,7 +11,6 @@
// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
#[feature(struct_variant)];
extern crate extra;
extern crate rand;
#[deriving(Eq)]

View File

@ -11,7 +11,6 @@
// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
#[feature(struct_variant)];
extern crate extra;
extern crate rand;
#[deriving(Eq)]

View File

@ -11,7 +11,6 @@
// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
#[feature(struct_variant)];
extern crate extra;
extern crate rand;
#[deriving(Eq)]

View File

@ -11,7 +11,6 @@
// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
#[feature(struct_variant)];
extern crate extra;
extern crate rand;
#[deriving(Eq)]

View File

@ -11,7 +11,6 @@
// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
#[feature(struct_variant)];
extern crate extra;
extern crate rand;

View File

@ -11,7 +11,6 @@
// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
#[feature(struct_variant)];
extern crate extra;
extern crate rand;

View File

@ -11,7 +11,6 @@
// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
#[feature(struct_variant)];
extern crate extra;
extern crate rand;

View File

@ -11,7 +11,6 @@
// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
#[feature(struct_variant)];
extern crate extra;
extern crate rand;

View File

@ -11,7 +11,6 @@
// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
#[feature(struct_variant)];
extern crate extra;
extern crate rand;

View File

@ -11,7 +11,6 @@
// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
#[feature(struct_variant)];
extern crate extra;
extern crate rand;

View File

@ -11,7 +11,6 @@
// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
#[feature(struct_variant)];
extern crate extra;
extern crate rand;

View File

@ -11,7 +11,6 @@
// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
#[feature(struct_variant)];
extern crate extra;
extern crate rand;

View File

@ -11,7 +11,6 @@
// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
#[feature(struct_variant)];
extern crate extra;
extern crate rand;
#[deriving(Eq)]

View File

@ -11,7 +11,6 @@
// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
#[feature(struct_variant)];
extern crate extra;
extern crate rand;
#[deriving(Eq)]

View File

@ -11,7 +11,6 @@
// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
#[feature(struct_variant)];
extern crate extra;
extern crate rand;
#[deriving(Eq)]

View File

@ -11,7 +11,6 @@
// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
#[feature(struct_variant)];
extern crate extra;
extern crate rand;
#[deriving(Eq)]

View File

@ -11,7 +11,6 @@
// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
#[feature(struct_variant)];
extern crate extra;
extern crate rand;
#[deriving(Eq, Ord, TotalEq)]

View File

@ -11,7 +11,6 @@
// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
#[feature(struct_variant)];
extern crate extra;
extern crate rand;
#[deriving(Eq, Ord, TotalEq)]

View File

@ -11,7 +11,6 @@
// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
#[feature(struct_variant)];
extern crate extra;
extern crate rand;
#[deriving(Eq, Ord, TotalEq)]

View File

@ -11,7 +11,6 @@
// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
#[feature(struct_variant)];
extern crate extra;
extern crate rand;
#[deriving(Eq, Ord, TotalEq)]

View File

@ -11,7 +11,6 @@
// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
#[feature(struct_variant)];
extern crate extra;
extern crate rand;

View File

@ -11,7 +11,6 @@
// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
#[feature(struct_variant)];
extern crate extra;
extern crate rand;

View File

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
extern crate extra;
fn siphash(k0 : u64) {
struct siphash {

View File

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
extern crate extra;
fn siphash<T>() {
trait t {

View File

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
extern crate extra;
trait siphash {
fn result(&self) -> u64;
fn reset(&self);

View File

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
extern crate extra;
trait SipHash {
fn reset(&self);
}

View File

@ -12,8 +12,6 @@
// temporary kinds wound up being stored in a cache and used later.
// See middle::ty::type_contents() for more information.
extern crate extra;
struct List { key: int, next: Option<~List> }
fn foo(node: ~List) -> int {

View File

@ -9,8 +9,6 @@
// except according to those terms.
extern crate extra;
enum bar { t1((), Option<~[int]>), t2, }
// n.b. my change changes this error message, but I think it's right -- tjc

View File

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
extern crate extra;
// error-pattern: mismatched types
enum bar { t1((), Option<~[int]>), t2, }

View File

@ -12,7 +12,6 @@
#[feature(quote)];
extern crate extra;
extern crate syntax;
use io::*;

View File

@ -12,11 +12,8 @@
#[feature(quote)];
extern crate extra;
extern crate syntax;
use extra::io::*;
use syntax::diagnostic;
use syntax::ast;
use syntax::codemap;

View File

@ -9,8 +9,6 @@
// except according to those terms.
mod argparse {
extern crate extra;
pub struct Flag<'a> {
name: &'a str,
desc: &'a str,

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
extern crate extra;
fn main() {
trait seq { }

View File

@ -10,8 +10,6 @@
// error-pattern: mismatched types
extern crate extra;
use std::task;
fn main() { task::spawn(|| -> int { 10 }); }

View File

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
extern crate extra;
use extra; //~ ERROR unresolved import (maybe you meant `extra::*`?)
extern crate collections;
use collections; //~ ERROR unresolved import (maybe you meant `collections::*`?)
fn main() {}

View File

@ -8,12 +8,12 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
extern crate extra;
extern crate test;
fn f() {
}
use extra::net; //~ ERROR `use` and `extern crate` declarations must precede items
use test::net; //~ ERROR `use` and `extern crate` declarations must precede items
fn main() {
}

View File

@ -9,5 +9,4 @@
// except according to those terms.
// error-pattern:moop
extern crate extra;
fn main() { fail!("moop"); }

View File

@ -9,6 +9,5 @@
// except according to those terms.
// error-pattern:meh
extern crate extra;
fn main() { let str_var: ~str = ~"meh"; fail!("{}", str_var); }

View File

@ -9,6 +9,5 @@
// except according to those terms.
// error-pattern:moop
extern crate extra;
fn main() { for _ in range(0u, 10u) { fail!("moop"); } }

View File

@ -16,8 +16,6 @@
// See the hack in upcall_call_shim_on_c_stack where it messes
// with the stack limit.
extern crate extra;
use std::libc;
use std::task;

View File

@ -13,8 +13,6 @@
// Just testing unwinding
extern crate extra;
use std::task;
fn getbig_and_fail(i: int) {

View File

@ -13,8 +13,6 @@
// Just testing unwinding
extern crate extra;
use std::task;
fn getbig_and_fail(i: int) {

View File

@ -12,8 +12,6 @@
// compile-flags:--test
// check-stdout
extern crate extra;
mod m {
pub fn exported() { }

View File

@ -13,7 +13,6 @@
#[feature(quote)];
extern crate extra;
extern crate syntax;
use std::io::*;

View File

@ -11,7 +11,7 @@
// error-pattern:expected item
#[foo = "bar"]
extern crate extra;
extern crate test;
pub fn main() {
}

View File

@ -12,7 +12,7 @@
mod m {
#[foo = "bar"]
extern crate extra;
extern crate test;
}
pub fn main() {

View File

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
extern crate extra;
fn asSendfn(f: proc() -> uint) -> uint {
return f();
}

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
extern crate extra;
use std::task::spawn;
struct Pair {

View File

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
extern crate extra;
/**
* A function that returns a hash of a value
*

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
extern crate extra;
extern crate mystd = "std";
pub fn main() {}

Some files were not shown because too many files have changed in this diff Show More