extern crate log;
use std::os;
-use std::vec_ng::Vec;
use std::io;
use std::io::fs;
use getopts::{optopt, optflag, reqopt};
// except according to those terms.
use std::io::{BufferedReader, File};
-use std::vec_ng::Vec;
pub struct ExpectedError { line: uint, kind: ~str, msg: ~str }
use common;
use util;
-use std::vec_ng::Vec;
-
pub struct TestProps {
// Lines that should be expected, in order, on standard out
error_patterns: Vec<~str> ,
use std::str;
use std::task;
use std::slice;
-use std::vec_ng;
-
+use std::vec;
use test::MetricMap;
pub fn run(config: config, testfile: ~str) {
mod tests {
extern crate test;
- use std::vec_ng::Vec;
use self::test::BenchHarness;
use super::{Arena, TypedArena};
use std::result::{Err, Ok};
use std::result;
- use std::vec_ng::Vec;
fn check_fail_type(f: Fail_, ft: FailType) {
match f {
use super::{Arc, RWArc, MutexArc, CowArc};
use std::task;
- use std::vec_ng::Vec;
#[test]
fn manually_share_arc() {
use std::result;
use std::task;
use std::comm::Empty;
- use std::vec_ng::Vec;
/************************************************************************
* Semaphore tests
mod test {
use super::{expand,String,Variables,Number};
use std::result::Ok;
- use std::vec_ng;
+ use std::vec;
#[test]
fn test_basic_setabf() {
Version5Sha1};
use std::str;
use std::io::MemWriter;
- use std::vec_ng::Vec;
#[test]
fn test_nil() {
use std::libc;
-use std::vec_ng::Vec;
#[link(name="rustrt")]
extern {
pub fn rust_get_test_int() -> libc::intptr_t;
// except according to those terms.
pub mod kitties {
- use std::vec_ng::Vec;
pub struct cat<U> {
priv info : Vec<U> ,
#[feature(managed_boxes)];
use std::cell::RefCell;
-use std::vec_ng::Vec;
pub struct Entry<A,B> {
key: A,
#[crate_id="cci_no_inline_lib"];
-use std::vec_ng::Vec;
// same as cci_iter_lib, more-or-less, but not marked inline
pub fn iter(v: Vec<uint> , f: |uint|) {
extern crate collections;
use std::cell::RefCell;
-use std::vec_ng::Vec;
use collections::HashMap;
pub type header_map = HashMap<~str, @RefCell<Vec<@~str>>>;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::vec_ng::Vec;
pub unsafe fn f(xs: Vec<int> ) {
xs.map(|_x| { unsafe fn q() { fail!(); } });
use std::os;
use std::uint;
-use std::vec_ng::Vec;
fn main() {
let args = os::args();
use std::os;
use std::task;
use std::uint;
-use std::vec_ng::Vec;
fn move_out<T>(_x: T) {}
use std::os;
use std::task;
use std::uint;
-use std::vec_ng::Vec;
fn move_out<T>(_x: T) {}
use sync::Future;
use std::os;
use std::uint;
-use std::vec_ng::Vec;
// A poor man's pipe.
type pipe = MutexArc<Vec<uint> >;
use sync::Future;
use std::os;
use std::uint;
-use std::vec_ng::Vec;
// A poor man's pipe.
type pipe = RWArc<Vec<uint> >;
// except according to those terms.
use std::os;
-use std::vec_ng::Vec;
fn ack(m: int, n: int) -> int {
if m == 0 {
use std::option;
use std::os;
use std::task;
-use std::vec_ng::Vec;
fn print_complements() {
let all = [Blue, Red, Yellow];
use std::io::{BufferedWriter, File};
use std::cmp::min;
use std::os;
-use std::vec_ng::Vec;
static LINE_LENGTH: uint = 60;
static IM: u32 = 139968;
// except according to those terms.
use std::os;
-use std::vec_ng::Vec;
fn fib(n: int) -> int {
if n < 2 {
use std::io;
use std::str;
use std::task;
-use std::slice;
+use std::vec;
fn f64_cmp(x: f64, y: f64) -> Ordering {
// arbitrarily decide that NaNs are larger than everything.
// Utilities.
//
-use std::vec_ng::Vec;
// returns an infinite iterator of repeated applications of f to x,
// i.e. [x, f(x), f(f(x)), ...], as haskell iterate function.
// except according to those terms.
use std::os;
-use std::vec_ng::Vec;
static PI: f64 = 3.141592653589793;
static SOLAR_MASS: f64 = 4.0 * PI * PI;
use std::result::{Ok, Err};
use std::task;
use std::uint;
-use std::vec_ng::Vec;
fn fib(n: int) -> int {
fn pfib(tx: &Sender<int>, n: int) {
use std::iter::count;
use std::cmp::min;
use std::os;
-use std::slice::from_elem;
use sync::RWArc;
fn A(i: uint, j: uint) -> f64 {
spawn(proc() {
for i in range(chk, min(len, chk + chunk)) {
let val = v.read(|v| f(v, i));
- out.write(|out| out[i] = val);
+ out.write(|out| *out.get_mut(i) = val);
}
drop(tx)
});
} else {
FromStr::from_str(args[1]).unwrap()
};
- let u = RWArc::new(from_elem(n, 1.));
- let v = RWArc::new(from_elem(n, 1.));
- let tmp = RWArc::new(from_elem(n, 1.));
+ let u = RWArc::new(Vec::from_elem(n, 1.));
+ let v = RWArc::new(Vec::from_elem(n, 1.));
+ let tmp = RWArc::new(Vec::from_elem(n, 1.));
for _ in range(0, 10) {
mult_AtAv(u.clone(), v.clone(), tmp.clone());
mult_AtAv(v.clone(), u.clone(), tmp.clone());
}
u.read(|u| v.read(|v| {
- println!("{:.9f}", (dot(*u, *v) / dot(*v, *v)).sqrt());
+ println!("{:.9f}",
+ (dot(u.as_slice(), v.as_slice()) / dot(v.as_slice(), v.as_slice())).sqrt());
}))
}
use collections::SmallIntMap;
use std::os;
use std::uint;
-use std::vec_ng::Vec;
fn append_sequential(min: uint, max: uint, map: &mut SmallIntMap<uint>) {
for i in range(min, max) {
let mut g = Vec::from_fn(10u, { |_i| vec!(0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8) });
for line in reader.lines() {
+ let line = line.unwrap();
let comps: Vec<&str> = line.trim().split(',').collect();
if comps.len() == 3u {
use time::precise_time_s;
use std::os;
use std::task;
-use std::vec_ng::Vec;
-use std::vec_ng;
+use std::vec;
enum UniqueList {
ULNil, ULCons(~UniqueList)
use std::os;
use std::task;
use std::uint;
-use std::vec_ng::Vec;
fn child_generation(gens_left: uint, tx: comm::Sender<()>) {
// This used to be O(n^2) in the number of generations that ever existed.
use std::os;
use std::task;
use std::uint;
-use std::vec_ng::Vec;
fn f(n: uint) {
let mut i = 0u;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::vec_ng::Vec;
struct sty(Vec<int> );
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::vec_ng::Vec;
trait foo {
fn foo(&self) -> int;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::vec_ng::Vec;
fn test() {
let v: int;
#[feature(managed_boxes)];
-use std::vec_ng::Vec;
type Foo = Vec<u8>;
use zed::bar;
use zed::baz;
-use std::vec_ng::Vec;
mod zed {
pub fn bar() { println!("bar"); }
use baz::zed::bar; //~ ERROR unresolved import
//~^ ERROR failed to resolve import
-use std::vec_ng::Vec;
mod baz {}
mod zed {
// error-pattern: import
-use std::vec_ng::Vec;
mod a { pub use b::foo; }
mod b { pub use a::foo; }
// error-pattern: illegal recursive type
-use std::vec_ng::Vec;
type x = Vec<x>;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-// error-pattern:expected `[` but found `~`
+// error-pattern:expected `[` but found `vec`
mod blade_runner {
- #vec!(doc(
+ #vec[doc(
brief = "Blade Runner is probably the best movie ever",
desc = "I like that in the world of Blade Runner it is always
raining, and that it's always night time. And Aliens
was also a really good movie.
Alien 3 was crap though."
- ))
+ )]
}
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::vec_ng::Vec;
trait vec_monad<A> {
fn bind<B>(&self, f: |A| -> Vec<B> );
#[allow(dead_code)];
#[allow(deprecated_owned_vector)];
-use std::vec_ng::Vec;
fn fail_len(v: Vec<int> ) -> uint {
let mut i = 3;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::vec_ng::Vec;
struct parser {
tokens: Vec<int> ,
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::vec_ng::Vec;
fn main() {
let needlesArr: Vec<char> = vec!('a', 'f');
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::vec_ng::Vec;
pub struct CrateId {
local_path: ~str,
// Test which of the builtin types are considered freezeable.
-use std::vec_ng::Vec;
fn assert_freeze<T:Freeze>() { }
trait Dummy { }
#[feature(managed_boxes)];
use std::rc::Rc;
-use std::vec_ng::Vec;
fn assert_pod<T:Pod>() { }
trait Dummy { }
// Test which of the builtin types are considered sendable.
-use std::vec_ng::Vec;
fn assert_send<T:Send>() { }
trait Dummy { }
#[allow(deprecated_owned_vector)];
#[deny(unused_mut)];
-use std::vec_ng::Vec;
fn main() {
// negative cases
#[deny(unused_unsafe)];
#[allow(deprecated_owned_vector)];
-use std::vec_ng::Vec;
mod foo {
extern {
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::vec_ng::Vec;
fn main() {
let x: Vec<(int, int)> = Vec::new();
fn f120() {
let mut x = vec!(~"hi", ~"ho");
- x.swap(0, 1);
+ x.as_mut_slice().swap(0, 1);
touch(x.get(0));
touch(x.get(1));
}
// except according to those terms.
use std::libc;
-use std::vec_ng::Vec;
fn main() {
let x : *Vec<int> = &vec!(1,2,3);
// Issue #876
#[no_implicit_prelude];
-
-use std::vec_ng::Vec;
+use std::vec::Vec;
fn last<T>(v: Vec<&T> ) -> std::option::Option<T> {
fail!();
#[feature(managed_boxes)];
use std::cell::Cell;
-use std::vec_ng::Vec;
struct r {
i: @Cell<int>,
// ignore-tidy-linelength
use std::fmt;
-use std::vec_ng::Vec;
struct Number {
n: i64
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::vec_ng::Vec;
fn main() {
let _foo = Vec::new(); //~ ERROR unconstrained type
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::vec_ng::Vec;
fn main() {
let v: Vec<int> = vec!(1, 2, 3);
+++ /dev/null
-// 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.
-
-// ignore-android: FIXME(#10381)
-
-#[feature(managed_boxes)];
-
-// compile-flags:-g
-// debugger:rbreak zzz
-// debugger:run
-// debugger:finish
-
-// debugger:print unique->fill
-// check:$1 = 32
-// debugger:print *((uint64_t[4]*)(unique->elements))
-// check:$2 = {10, 11, 12, 13}
-
-#[allow(unused_variable)];
-
-fn main() {
-
- let unique: Vec<i64> = vec!(10, 11, 12, 13);
-
- zzz();
-}
-
-fn zzz() {()}
// except according to those terms.
fn main() {
- let args : Vec<~str> = ::std::os::args();
+ let args : ~[~str] = ::std::os::args();
::std::io::println(args[0]);
}
// debugger:run
// debugger:finish
-// debugger:print unique->elements[0]->val
+// debugger:print unique.ptr[0]->val
// check:$1 = 10
-// debugger:print unique->elements[1]->val
+// debugger:print unique.ptr[1]->val
// check:$2 = 11
-// debugger:print unique->elements[2]->val
+// debugger:print unique.ptr[2]->val
// check:$3 = 12
-// debugger:print unique->elements[3]->val
+// debugger:print unique.ptr[3]->val
// check:$4 = 13
#[allow(unused_variable)];
#[feature(managed_boxes)];
use std::cell::Cell;
-use std::vec_ng::Vec;
fn test1() { let val = @0; { } *val; }
#[allow(unreachable_code)];
#[allow(unused_variable)];
-use std::vec_ng::Vec;
// error-pattern:so long
fn main() {
extern crate collections;
-use std::vec_ng::Vec;
-use std::vec_ng;
+use std::vec;
fn main() {
let _count = @0u;
#[feature(managed_boxes)];
-use std::vec_ng::Vec;
fn f() -> Vec<int> { fail!(); }
#[feature(managed_boxes)];
-use std::vec_ng::Vec;
fn f() -> Vec<int> { fail!(); }
#[feature(managed_boxes)];
-use std::vec_ng::Vec;
fn f() -> Vec<int> { fail!(); }
// error-pattern:fail
-use std::vec_ng::Vec;
fn build() -> Vec<int> {
fail!();
// error-pattern:fail
-use std::vec_ng::Vec;
fn build1() -> Vec<int> {
vec!(0,0,0,0,0,0,0)
#[feature(managed_boxes)];
-use std::vec_ng::Vec;
// error-pattern:fail
#[feature(managed_boxes)];
-use std::vec_ng::Vec;
// error-pattern:fail
// error-pattern:index out of bounds: the len is 1 but the index is 2
-use std::vec_ng::Vec;
fn main() {
let v: Vec<int> = vec!(10);
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::vec_ng::Vec;
enum option<T> { some(T), none, }
// making method calls, but only if there aren't any matches without
// it.
-use std::vec_ng::Vec;
trait iterable<A> {
fn iterate(&self, blk: |x: &A| -> bool) -> bool;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::vec_ng::Vec;
trait Pushable<T> {
fn push_val(&mut self, t: T);
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::vec_ng::Vec;
fn f<T>(x: Vec<T>) -> T { return x.move_iter().next().unwrap(); }
// ignore-fast
-use std::vec_ng::Vec;
fn iter_vec<T>(v: Vec<T> , f: |&T|) { for x in v.iter() { f(x); } }
// ignore-fast
-use std::vec_ng::Vec;
fn iter_vec<T>(v: Vec<T> , f: |&T|) { for x in v.iter() { f(x); } }
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::vec_ng::Vec;
trait Foo {
fn foo(self);
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::vec_ng::Vec;
struct F { f: Vec<int> }
// except according to those terms.
use std::mem::swap;
-use std::vec_ng::Vec;
struct Ints {sum: ~int, values: Vec<int> }
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::vec_ng::Vec;
fn want_slice(v: &[int]) -> int {
let mut sum = 0;
#[feature(managed_boxes)];
-use std::vec_ng::Vec;
struct F { f: @G }
struct G { g: Vec<int> }
#[feature(managed_boxes)];
-use std::vec_ng::Vec;
fn borrow<'r,T>(x: &'r T) -> &'r T {x}
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::vec_ng::Vec;
fn foo() -> int { 22 }
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::vec_ng::Vec;
struct cat<U> {
info : Vec<U> ,
#[feature(macro_rules)];
use std::ops::Drop;
-use std::vec_ng::Vec;
static mut FLAGS: u64 = 0;
// scenario worth testing.
use std::task;
-use std::vec_ng::Vec;
enum Conzabble {
Bickwick(Foo)
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::vec_ng::Vec;
fn bar(v: &mut [uint]) -> Vec<uint> {
Vec::from_slice(v)
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::vec_ng::Vec;
fn reverse(v: &mut [uint]) {
v.reverse();
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::vec_ng::Vec;
fn bar(v: &mut [uint]) {
v.reverse();
#[allow(unused_mut)];
-use std::vec_ng::Vec;
pub fn main() { let mut _v: Vec<int> = Vec::new(); }
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::vec_ng::Vec;
fn test_int() {
fn f() -> int { 10 }
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::vec_ng::Vec;
fn test_simple() {
let r = match true { true => { true } false => { fail!() } };
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::vec_ng::Vec;
pub fn main() { let x: Vec<int> = Vec::new(); for _ in x.iter() { fail!("moop"); } }
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::vec_ng::Vec;
fn two(it: |int|) { it(0); it(1); }
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::vec_ng::Vec;
trait vec_utils<T> {
fn map_<U>(x: &Self, f: |&T| -> U) -> Vec<U> ;
extern crate getopts;
use getopts::{optopt, getopts};
-use std::vec_ng::Vec;
pub fn main() {
let args = Vec::new();
extern crate collections;
-use std::vec_ng::Vec;
/**
A somewhat reduced test case to expose some Valgrind issues.
use collections::HashMap;
use std::str;
use std::task;
- use std::vec_ng::Vec;
pub type putter<'a> = 'a |~str, ~str|;
#[feature(macro_rules)];
-use std::vec_ng::Vec;
/*
let (mut x, mut y) = (1, 2);
swap(&mut x, &mut y);
assert_eq!(x, 2);
- assert_eq!(x, 1);
+ assert_eq!(y, 1);
}
// issue #680
-use std::vec_ng::Vec;
fn f() -> Vec<int> { Vec::new() }
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::vec_ng::Vec;
// This is a testcase for issue #94.
pub fn main() {
// Issue #1821 - Don't recurse trying to typecheck this
-use std::vec_ng::Vec;
enum t {
foo(Vec<t>)
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::vec_ng::Vec;
struct font<'a> {
fontbuf: &'a Vec<u8> ,
use collections::HashMap;
use serialize::json;
use std::option;
-use std::vec_ng::Vec;
enum object {
bool_value(bool),
use std::io;
use std::fmt;
-use std::vec_ng::Vec;
enum square {
bot,
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::vec_ng::Vec;
type Connection = 'static |Vec<u8> |;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::vec_ng::Vec;
struct trie_node {
content: Vec<~str> ,
use std::str;
use std::slice;
use std::fmt;
-use std::vec_ng::Vec;
// Represents a position on a canvas.
struct Point {
// except according to those terms.
use std::task;
-use std::vec_ng::Vec;
type RingBuffer = Vec<f64> ;
type SamplesFn = proc(samples: &RingBuffer);
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::vec_ng::Vec;
struct HasNested {
nest: Vec<Vec<int> > ,
extern crate serialize;
use serialize::{json, Decodable};
-use std::vec_ng::Vec;
pub fn main() {
let json = json::from_str("[1]").unwrap();
to traits.
*/
-use std::vec_ng::Vec;
// original
trait Inner {
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::vec_ng::Vec;
fn swap(f: |Vec<int> | -> Vec<int> ) -> Vec<int> {
let x = vec!(1, 2, 3);
// from a vector to a slice. The drop glue was being invoked on
// the temporary slice with a wrong type, triggering an LLVM assert.
-use std::vec_ng::Vec;
struct Thing1<'a> {
baz: &'a [~int],
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::vec_ng::Vec;
fn f(_a: Vec<int> ) { }
pub fn main() { f(vec!(1, 2, 3, 4, 5)); }
// except according to those terms.
use std::task;
-use std::vec_ng::Vec;
fn producer(tx: &Sender<Vec<u8>>) {
tx.send(
// This should typecheck even though the type of e is not fully
// resolved when we finish typechecking the ||.
-use std::vec_ng::Vec;
struct Refs { refs: Vec<int> , n: int }
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::vec_ng::Vec;
fn take(x: int) -> int {x}
// Tests that matching rvalues with drops does not crash.
-use std::vec_ng::Vec;
pub fn main() {
match vec!(1, 2, 3) {
// ignore-fast
-use std::vec_ng::Vec;
trait vec_monad<A> {
fn bind<B>(&self, f: |&A| -> Vec<B> ) -> Vec<B> ;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::vec_ng::Vec;
fn test(foo: ~Vec<int> ) { assert!((*foo.get(0) == 10)); }
#[feature(managed_boxes)];
-use std::vec_ng::Vec;
fn test(foo: @Vec<int> ) { assert!((*foo.get(0) == 10)); }
#[feature(managed_boxes)];
#[allow(unused_mut)];
-use std::vec_ng::Vec;
struct Pair { a: int, b: int}
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::vec_ng::Vec;
#[deriving(Clone)]
struct myvec<X>(Vec<X> );
#[feature(macro_rules)];
use std::{option, cast};
-use std::vec_ng::Vec;
// Iota-reduction is a rule in the Calculus of (Co-)Inductive Constructions,
// which "says that a destructor applied to an object built from a constructor
#[feature(macro_rules)];
use std::mem;
-use std::vec_ng::Vec;
enum E<T> { Thing(int, T), Nothing((), ((), ()), [i8, ..0]) }
struct S<T>(int, T);
#[feature(managed_boxes)];
-use std::vec_ng::Vec;
// Test invoked `&self` methods on owned objects where the values
// closed over contain managed values. This implies that the ~ boxes
// closed over do not contain managed values, and thus the ~ boxes do
// not have headers.
-use std::vec_ng::Vec;
trait FooTrait {
fn foo(&self) -> uint;
// takes its argument *by reference*.
use std::ops::Index;
-use std::vec_ng::Vec;
struct AssociationList<K,V> {
pairs: Vec<AssociationPair<K,V>> }
use std::cell::RefCell;
use std::rc::Rc;
-use std::vec_ng::Vec;
#[deriving(Eq, Show)]
struct Point {
// except according to those terms.
use std::mem;
-use std::vec_ng::Vec;
#[packed]
struct S<T, S> {
// Check that functions can modify local state.
-use std::vec_ng::Vec;
fn sums_to(v: Vec<int> , sum: int) -> bool {
let mut i = 0u;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::vec_ng::Vec;
trait sum {
fn sum_(self) -> int;
assert_eq!(y, 6);
let x = vec!(1, 2, 3);
- let y = x..as_slice().sum_();
+ let y = x.as_slice().sum_();
println!("y=={}", y);
assert_eq!(y, 6);
#[feature(managed_boxes)];
use std::intrinsics::{TyDesc, get_tydesc, visit_tydesc, TyVisitor, Disr, Opaque};
-use std::vec_ng::Vec;
struct MyVisitor {
types: Vec<~str> ,
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::vec_ng::Vec;
fn foo(x: &[int]) -> int {
x[0]
// Test lifetimes are linked properly when we create dependent region pointers.
// Issue #3148.
-use std::vec_ng::Vec;
struct A {
value: B
// Test lifetimes are linked properly when we autoslice a vector.
// Issue #3148.
-use std::vec_ng::Vec;
fn subslice1<'r>(v: &'r [uint]) -> &'r [uint] { v }
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::vec_ng::Vec;
fn view<'r, T>(x: &'r [T]) -> &'r [T] {x}
use std::cast;
use std::libc;
use std::mem;
-use std::vec_ng::Vec;
type Type<'tcx> = &'tcx TypeStructure<'tcx>;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::vec_ng::Vec;
pub fn main() {
assert!((~"hello" < ~"hellr"));
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::vec_ng::Vec;
fn foo(c: Vec<int> ) {
let a: int = 5;
// interior record which is then itself interior to
// something else, shape calculations were off.
-use std::vec_ng::Vec;
#[deriving(Clone)]
enum opt_span {
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::vec_ng::Vec;
enum clam<T> { a(T, int), b, }
// ignore-fast
-use std::vec_ng::Vec;
pub trait plus {
fn plus(&self) -> int;
// except according to those terms.
use std::mem::swap;
-use std::vec_ng::Vec;
pub fn main() {
let mut a: Vec<int> = vec!(0, 1, 2, 3, 4, 5, 6);
- a.swap(2, 4);
+ a.as_mut_slice().swap(2, 4);
assert_eq!(*a.get(2), 4);
assert_eq!(*a.get(4), 2);
let mut n = 42;
// except according to those terms.
use std::cmp;
-use std::vec_ng::Vec;
// Tests of ports and channels on various types
fn test_rec() {
// ignore-fast
use std::task;
-use std::vec_ng::Vec;
pub fn main() { println!("===== WITHOUT THREADS ====="); test00(); }
use sync::Arc;
use std::task;
-use std::vec_ng::Vec;
trait Pet {
fn name(&self, blk: |&str|);
// ignore-fast
-use std::vec_ng::Vec;
trait to_str {
fn to_string(&self) -> ~str;
// ignore-fast
-use std::vec_ng::Vec;
trait to_str {
fn to_string(&self) -> ~str;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::vec_ng::Vec;
struct S<T> {
a: T,
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::vec_ng::Vec;
pub fn main() {
let i = ~vec!(100);
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::vec_ng::Vec;
pub fn main() {
let mut a = vec!(~10);
// except according to those terms.
use std::str;
-use std::vec_ng::Vec;
pub fn main() {
// Chars of 1, 2, 3, and 4 bytes
let a: Vec<int> = vec!(1, 2, 3, 4, 5);
let b: Vec<int> = vec!(6, 7, 8, 9, 0);
let v: Vec<int> = vec::append(a, b.as_slice());
- println!("{}", v[9]);
+ println!("{}", *v.get(9));
assert_eq!(*v.get(0), 1);
assert_eq!(*v.get(7), 8);
assert_eq!(*v.get(9), 0);
#[feature(managed_boxes)];
-use std::vec_ng::Vec;
struct Pair { x: int, y: int }
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::vec_ng::Vec;
pub fn main() {
let mut v = vec!(1);
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::vec_ng::Vec;
pub fn main() {
let mut later: Vec<int> ;
+++ /dev/null
-// 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.
-
-fn test_heap_to_heap() {
- // a spills onto the heap
- let mut a = vec!(0, 1, 2, 3, 4);
- a = a + a; // FIXME(#3387)---can't write a += a
- assert_eq!(a.len(), 10u);
- assert_eq!(a[0], 0);
- assert_eq!(a[1], 1);
- assert_eq!(a[2], 2);
- assert_eq!(a[3], 3);
- assert_eq!(a[4], 4);
- assert_eq!(a[5], 0);
- assert_eq!(a[6], 1);
- assert_eq!(a[7], 2);
- assert_eq!(a[8], 3);
- assert_eq!(a[9], 4);
-}
-
-fn test_stack_to_heap() {
- // a is entirely on the stack
- let mut a = vec!(0, 1, 2);
- // a spills to the heap
- a = a + a; // FIXME(#3387)---can't write a += a
- assert_eq!(a.len(), 6u);
- assert_eq!(a[0], 0);
- assert_eq!(a[1], 1);
- assert_eq!(a[2], 2);
- assert_eq!(a[3], 0);
- assert_eq!(a[4], 1);
- assert_eq!(a[5], 2);
-}
-
-fn test_loop() {
- // Make sure we properly handle repeated self-appends.
- let mut a: Vec<int> = vec!(0);
- let mut i = 20;
- let mut expected_len = 1u;
- while i > 0 {
- println!("{}", a.len());
- assert_eq!(a.len(), expected_len);
- a = a + a; // FIXME(#3387)---can't write a += a
- i -= 1;
- expected_len *= 2u;
- }
-}
-
-pub fn main() { test_heap_to_heap(); test_stack_to_heap(); test_loop(); }
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::vec_ng::Vec;
pub fn main() {
let v: Vec<int> = vec!(10, 20);
#[feature(managed_boxes)];
-use std::vec_ng::Vec;
pub fn main() { let _quux: @Vec<uint> = @Vec::new(); }
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use std::vec_ng::Vec;
pub fn main() {
let mut i: int = 90;