test: Automatically remove all ~[T]
from tests.
This commit is contained in:
parent
0b714b4ba6
commit
579eb2400b
247 changed files with 626 additions and 640 deletions
|
@ -12,6 +12,7 @@
|
|||
|
||||
use std::libc;
|
||||
|
||||
use std::vec_ng::Vec;
|
||||
#[link(name="rustrt")]
|
||||
extern {
|
||||
pub fn rust_get_test_int() -> libc::intptr_t;
|
||||
|
|
|
@ -10,21 +10,21 @@
|
|||
|
||||
pub mod kitties {
|
||||
pub struct cat<U> {
|
||||
priv info : ~[U],
|
||||
priv info : Vec<U> ,
|
||||
priv meows : uint,
|
||||
|
||||
how_hungry : int,
|
||||
}
|
||||
|
||||
impl<U> cat<U> {
|
||||
pub fn speak<T>(&mut self, stuff: ~[T]) {
|
||||
pub fn speak<T>(&mut self, stuff: Vec<T> ) {
|
||||
self.meows += stuff.len();
|
||||
}
|
||||
|
||||
pub fn meow_count(&mut self) -> uint { self.meows }
|
||||
}
|
||||
|
||||
pub fn cat<U>(in_x : uint, in_y : int, in_info: ~[U]) -> cat<U> {
|
||||
pub fn cat<U>(in_x : uint, in_y : int, in_info: Vec<U> ) -> cat<U> {
|
||||
cat {
|
||||
meows: in_x,
|
||||
how_hungry: in_y,
|
||||
|
|
|
@ -19,7 +19,7 @@ pub struct Entry<A,B> {
|
|||
|
||||
pub struct alist<A,B> {
|
||||
eq_fn: extern "Rust" fn(A,A) -> bool,
|
||||
data: @RefCell<~[Entry<A,B>]>,
|
||||
data: @RefCell<Vec<Entry<A,B>> >,
|
||||
}
|
||||
|
||||
pub fn alist_add<A:'static,B:'static>(lst: &alist<A,B>, k: A, v: B) {
|
||||
|
@ -47,7 +47,7 @@ pub fn new_int_alist<B:'static>() -> alist<int, B> {
|
|||
fn eq_int(a: int, b: int) -> bool { a == b }
|
||||
return alist {
|
||||
eq_fn: eq_int,
|
||||
data: @RefCell::new(~[]),
|
||||
data: @RefCell::new(Vec::new()),
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -57,6 +57,6 @@ pub fn new_int_alist_2<B:'static>() -> alist<int, B> {
|
|||
fn eq_int(a: int, b: int) -> bool { a == b }
|
||||
return alist {
|
||||
eq_fn: eq_int,
|
||||
data: @RefCell::new(~[]),
|
||||
data: @RefCell::new(Vec::new()),
|
||||
};
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#[crate_id="cci_no_inline_lib"];
|
||||
|
||||
// same as cci_iter_lib, more-or-less, but not marked inline
|
||||
pub fn iter(v: ~[uint], f: |uint|) {
|
||||
pub fn iter(v: Vec<uint> , f: |uint|) {
|
||||
let mut i = 0u;
|
||||
let n = v.len();
|
||||
while i < n {
|
||||
|
|
|
@ -17,7 +17,7 @@ extern crate collections;
|
|||
use std::cell::RefCell;
|
||||
use collections::HashMap;
|
||||
|
||||
pub type header_map = HashMap<~str, @RefCell<~[@~str]>>;
|
||||
pub type header_map = HashMap<~str, @RefCell<vec!(@~str)>>;
|
||||
|
||||
// the unused ty param is necessary so this gets monomorphized
|
||||
pub fn request<T>(req: &header_map) {
|
||||
|
|
|
@ -8,6 +8,6 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
pub unsafe fn f(xs: ~[int]) {
|
||||
pub unsafe fn f(xs: Vec<int> ) {
|
||||
xs.map(|_x| { unsafe fn q() { fail!(); } });
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ use std::mem::swap;
|
|||
use std::os;
|
||||
use std::str;
|
||||
use std::slice;
|
||||
use std::vec;
|
||||
use std::io::File;
|
||||
|
||||
macro_rules! bench (
|
||||
|
@ -61,8 +62,8 @@ fn maybe_run_test(argv: &[~str], name: ~str, test: ||) {
|
|||
}
|
||||
|
||||
fn shift_push() {
|
||||
let mut v1 = slice::from_elem(30000, 1);
|
||||
let mut v2 = ~[];
|
||||
let mut v1 = Vec::from_elem(30000, 1);
|
||||
let mut v2 = Vec::new();
|
||||
|
||||
while v1.len() > 0 {
|
||||
v2.push(v1.shift().unwrap());
|
||||
|
@ -85,7 +86,7 @@ fn read_line() {
|
|||
fn vec_plus() {
|
||||
let mut r = rand::task_rng();
|
||||
|
||||
let mut v = ~[];
|
||||
let mut v = Vec::new();
|
||||
let mut i = 0;
|
||||
while i < 1500 {
|
||||
let rv = slice::from_elem(r.gen_range(0u, i + 1), i);
|
||||
|
@ -101,15 +102,15 @@ fn vec_plus() {
|
|||
fn vec_append() {
|
||||
let mut r = rand::task_rng();
|
||||
|
||||
let mut v = ~[];
|
||||
let mut v = Vec::new();
|
||||
let mut i = 0;
|
||||
while i < 1500 {
|
||||
let rv = slice::from_elem(r.gen_range(0u, i + 1), i);
|
||||
if r.gen() {
|
||||
v = slice::append(v, rv);
|
||||
v = vec::append(v, rv);
|
||||
}
|
||||
else {
|
||||
v = slice::append(rv, v);
|
||||
v = vec::append(rv, v);
|
||||
}
|
||||
i += 1;
|
||||
}
|
||||
|
@ -118,7 +119,7 @@ fn vec_append() {
|
|||
fn vec_push_all() {
|
||||
let mut r = rand::task_rng();
|
||||
|
||||
let mut v = ~[];
|
||||
let mut v = Vec::new();
|
||||
for i in range(0u, 1500) {
|
||||
let mut rv = slice::from_elem(r.gen_range(0u, i + 1), i);
|
||||
if r.gen() {
|
||||
|
@ -132,7 +133,7 @@ fn vec_push_all() {
|
|||
}
|
||||
|
||||
fn is_utf8_ascii() {
|
||||
let mut v : ~[u8] = ~[];
|
||||
let mut v : Vec<u8> = Vec::new();
|
||||
for _ in range(0u, 20000) {
|
||||
v.push('b' as u8);
|
||||
if !str::is_utf8(v) {
|
||||
|
@ -143,7 +144,7 @@ fn is_utf8_ascii() {
|
|||
|
||||
fn is_utf8_multibyte() {
|
||||
let s = "b¢€𤭢";
|
||||
let mut v : ~[u8]= ~[];
|
||||
let mut v : Vec<u8> = Vec::new();
|
||||
for _ in range(0u, 5000) {
|
||||
v.push_all(s.as_bytes());
|
||||
if !str::is_utf8(v) {
|
||||
|
|
|
@ -14,9 +14,9 @@ use std::uint;
|
|||
fn main() {
|
||||
let args = os::args();
|
||||
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||
~[~"", ~"10000000"]
|
||||
vec!(~"", ~"10000000")
|
||||
} else if args.len() <= 1u {
|
||||
~[~"", ~"100000"]
|
||||
vec!(~"", ~"100000")
|
||||
} else {
|
||||
args
|
||||
};
|
||||
|
|
|
@ -59,7 +59,7 @@ fn run(args: &[~str]) {
|
|||
let workers = from_str::<uint>(args[2]).unwrap();
|
||||
let num_bytes = 100;
|
||||
let start = time::precise_time_s();
|
||||
let mut worker_results = ~[];
|
||||
let mut worker_results = Vec::new();
|
||||
for _ in range(0u, workers) {
|
||||
let to_child = to_child.clone();
|
||||
let mut builder = task::task();
|
||||
|
@ -96,9 +96,9 @@ fn run(args: &[~str]) {
|
|||
fn main() {
|
||||
let args = os::args();
|
||||
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||
~[~"", ~"1000000", ~"10000"]
|
||||
vec!(~"", ~"1000000", ~"10000")
|
||||
} else if args.len() <= 1u {
|
||||
~[~"", ~"10000", ~"4"]
|
||||
vec!(~"", ~"10000", ~"4")
|
||||
} else {
|
||||
args.clone()
|
||||
};
|
||||
|
|
|
@ -53,7 +53,7 @@ fn run(args: &[~str]) {
|
|||
let workers = from_str::<uint>(args[2]).unwrap();
|
||||
let num_bytes = 100;
|
||||
let start = time::precise_time_s();
|
||||
let mut worker_results = ~[];
|
||||
let mut worker_results = Vec::new();
|
||||
let from_parent = if workers == 1 {
|
||||
let (to_child, from_parent) = channel();
|
||||
let mut builder = task::task();
|
||||
|
@ -106,9 +106,9 @@ fn run(args: &[~str]) {
|
|||
fn main() {
|
||||
let args = os::args();
|
||||
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||
~[~"", ~"1000000", ~"8"]
|
||||
vec!(~"", ~"1000000", ~"8")
|
||||
} else if args.len() <= 1u {
|
||||
~[~"", ~"10000", ~"4"]
|
||||
vec!(~"", ~"10000", ~"4")
|
||||
} else {
|
||||
args.clone()
|
||||
};
|
||||
|
|
|
@ -25,7 +25,7 @@ use std::os;
|
|||
use std::uint;
|
||||
|
||||
// A poor man's pipe.
|
||||
type pipe = MutexArc<~[uint]>;
|
||||
type pipe = MutexArc<Vec<uint> >;
|
||||
|
||||
fn send(p: &pipe, msg: uint) {
|
||||
unsafe {
|
||||
|
@ -47,7 +47,7 @@ fn recv(p: &pipe) -> uint {
|
|||
}
|
||||
|
||||
fn init() -> (pipe,pipe) {
|
||||
let m = MutexArc::new(~[]);
|
||||
let m = MutexArc::new(Vec::new());
|
||||
((&m).clone(), m)
|
||||
}
|
||||
|
||||
|
@ -71,9 +71,9 @@ fn thread_ring(i: uint, count: uint, num_chan: pipe, num_port: pipe) {
|
|||
fn main() {
|
||||
let args = os::args();
|
||||
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||
~[~"", ~"100", ~"10000"]
|
||||
vec!(~"", ~"100", ~"10000")
|
||||
} else if args.len() <= 1u {
|
||||
~[~"", ~"10", ~"100"]
|
||||
vec!(~"", ~"10", ~"100")
|
||||
} else {
|
||||
args.clone()
|
||||
};
|
||||
|
@ -86,7 +86,7 @@ fn main() {
|
|||
let start = time::precise_time_s();
|
||||
|
||||
// create the ring
|
||||
let mut futures = ~[];
|
||||
let mut futures = Vec::new();
|
||||
|
||||
for i in range(1u, num_tasks) {
|
||||
//println!("spawning %?", i);
|
||||
|
|
|
@ -24,7 +24,7 @@ use std::os;
|
|||
use std::uint;
|
||||
|
||||
// A poor man's pipe.
|
||||
type pipe = RWArc<~[uint]>;
|
||||
type pipe = RWArc<Vec<uint> >;
|
||||
|
||||
fn send(p: &pipe, msg: uint) {
|
||||
p.write_cond(|state, cond| {
|
||||
|
@ -42,7 +42,7 @@ fn recv(p: &pipe) -> uint {
|
|||
}
|
||||
|
||||
fn init() -> (pipe,pipe) {
|
||||
let x = RWArc::new(~[]);
|
||||
let x = RWArc::new(Vec::new());
|
||||
((&x).clone(), x)
|
||||
}
|
||||
|
||||
|
@ -66,9 +66,9 @@ fn thread_ring(i: uint, count: uint, num_chan: pipe, num_port: pipe) {
|
|||
fn main() {
|
||||
let args = os::args();
|
||||
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||
~[~"", ~"100", ~"10000"]
|
||||
vec!(~"", ~"100", ~"10000")
|
||||
} else if args.len() <= 1u {
|
||||
~[~"", ~"10", ~"100"]
|
||||
vec!(~"", ~"10", ~"100")
|
||||
} else {
|
||||
args.clone()
|
||||
};
|
||||
|
@ -81,7 +81,7 @@ fn main() {
|
|||
let start = time::precise_time_s();
|
||||
|
||||
// create the ring
|
||||
let mut futures = ~[];
|
||||
let mut futures = Vec::new();
|
||||
|
||||
for i in range(1u, num_tasks) {
|
||||
//println!("spawning %?", i);
|
||||
|
|
|
@ -25,9 +25,9 @@ fn ack(m: int, n: int) -> int {
|
|||
fn main() {
|
||||
let args = os::args();
|
||||
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||
~[~"", ~"12"]
|
||||
vec!(~"", ~"12")
|
||||
} else if args.len() <= 1u {
|
||||
~[~"", ~"8"]
|
||||
vec!(~"", ~"8")
|
||||
} else {
|
||||
args
|
||||
};
|
||||
|
|
|
@ -39,7 +39,7 @@ fn show_color(cc: color) -> ~str {
|
|||
}
|
||||
}
|
||||
|
||||
fn show_color_list(set: ~[color]) -> ~str {
|
||||
fn show_color_list(set: vec!(color)) -> ~str {
|
||||
let mut out = ~"";
|
||||
for col in set.iter() {
|
||||
out.push_char(' ');
|
||||
|
@ -132,7 +132,7 @@ fn creature(
|
|||
}
|
||||
}
|
||||
|
||||
fn rendezvous(nn: uint, set: ~[color]) {
|
||||
fn rendezvous(nn: uint, set: vec!(color)) {
|
||||
|
||||
// these ports will allow us to hear from the creatures
|
||||
let (to_rendezvous, from_creatures) = channel::<CreatureInfo>();
|
||||
|
@ -141,7 +141,7 @@ fn rendezvous(nn: uint, set: ~[color]) {
|
|||
// these channels will be passed to the creatures so they can talk to us
|
||||
|
||||
// these channels will allow us to talk to each creature by 'name'/index
|
||||
let to_creature: ~[Sender<Option<CreatureInfo>>] =
|
||||
let to_creature: Vec<Sender<Option<CreatureInfo>>> =
|
||||
set.iter().enumerate().map(|(ii, col)| {
|
||||
// create each creature as a listener with a port, and
|
||||
// give us a channel to talk to each
|
||||
|
@ -179,7 +179,7 @@ fn rendezvous(nn: uint, set: ~[color]) {
|
|||
}
|
||||
|
||||
// save each creature's meeting stats
|
||||
let mut report = ~[];
|
||||
let mut report = Vec::new();
|
||||
for _to_one in to_creature.iter() {
|
||||
report.push(from_creatures_log.recv());
|
||||
}
|
||||
|
@ -199,9 +199,9 @@ fn rendezvous(nn: uint, set: ~[color]) {
|
|||
fn main() {
|
||||
let args = os::args();
|
||||
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||
~[~"", ~"200000"]
|
||||
vec!(~"", ~"200000")
|
||||
} else if args.len() <= 1u {
|
||||
~[~"", ~"600"]
|
||||
vec!(~"", ~"600")
|
||||
} else {
|
||||
args
|
||||
};
|
||||
|
@ -211,9 +211,9 @@ fn main() {
|
|||
print_complements();
|
||||
println!("");
|
||||
|
||||
rendezvous(nn, ~[Blue, Red, Yellow]);
|
||||
rendezvous(nn, vec!(Blue, Red, Yellow));
|
||||
println!("");
|
||||
|
||||
rendezvous(nn,
|
||||
~[Blue, Red, Yellow, Red, Yellow, Blue, Red, Yellow, Red, Blue]);
|
||||
vec!(Blue, Red, Yellow, Red, Yellow, Blue, Red, Yellow, Red, Blue));
|
||||
}
|
||||
|
|
|
@ -59,8 +59,8 @@ static HOMO_SAPIENS: [AminoAcid, ..4] = [
|
|||
];
|
||||
|
||||
// FIXME: Use map().
|
||||
fn sum_and_scale(a: &'static [AminoAcid]) -> ~[AminoAcid] {
|
||||
let mut result = ~[];
|
||||
fn sum_and_scale(a: &'static [AminoAcid]) -> Vec<AminoAcid> {
|
||||
let mut result = Vec::new();
|
||||
let mut p = 0f32;
|
||||
for a_i in a.iter() {
|
||||
let mut a_i = *a_i;
|
||||
|
|
|
@ -36,8 +36,7 @@ impl MyRandom {
|
|||
|
||||
struct AAGen<'a> {
|
||||
rng: &'a mut MyRandom,
|
||||
data: ~[(u32, u8)]
|
||||
}
|
||||
data: Vec<(u32, u8)> }
|
||||
impl<'a> AAGen<'a> {
|
||||
fn new<'b>(rng: &'b mut MyRandom, aa: &[(char, f32)]) -> AAGen<'b> {
|
||||
let mut cum = 0.;
|
||||
|
|
|
@ -21,9 +21,9 @@ fn fib(n: int) -> int {
|
|||
fn main() {
|
||||
let args = os::args();
|
||||
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||
~[~"", ~"40"]
|
||||
vec!(~"", ~"40")
|
||||
} else if args.len() <= 1u {
|
||||
~[~"", ~"30"]
|
||||
vec!(~"", ~"30")
|
||||
} else {
|
||||
args
|
||||
};
|
||||
|
|
|
@ -42,19 +42,19 @@ fn f64_cmp(x: f64, y: f64) -> Ordering {
|
|||
}
|
||||
|
||||
// given a map, print a sorted version of it
|
||||
fn sort_and_fmt(mm: &HashMap<~[u8], uint>, total: uint) -> ~str {
|
||||
fn sort_and_fmt(mm: &HashMap<Vec<u8> , uint>, total: uint) -> ~str {
|
||||
fn pct(xx: uint, yy: uint) -> f64 {
|
||||
return (xx as f64) * 100.0 / (yy as f64);
|
||||
}
|
||||
|
||||
// sort by key, then by value
|
||||
fn sortKV(mut orig: ~[(~[u8],f64)]) -> ~[(~[u8],f64)] {
|
||||
fn sortKV(mut orig: Vec<(Vec<u8> ,f64)> ) -> Vec<(Vec<u8> ,f64)> {
|
||||
orig.sort_by(|&(ref a, _), &(ref b, _)| a.cmp(b));
|
||||
orig.sort_by(|&(_, a), &(_, b)| f64_cmp(b, a));
|
||||
orig
|
||||
}
|
||||
|
||||
let mut pairs = ~[];
|
||||
let mut pairs = Vec::new();
|
||||
|
||||
// map -> [(k,%)]
|
||||
for (key, &val) in mm.iter() {
|
||||
|
@ -76,7 +76,7 @@ fn sort_and_fmt(mm: &HashMap<~[u8], uint>, total: uint) -> ~str {
|
|||
}
|
||||
|
||||
// given a map, search for the frequency of a pattern
|
||||
fn find(mm: &HashMap<~[u8], uint>, key: ~str) -> uint {
|
||||
fn find(mm: &HashMap<Vec<u8> , uint>, key: ~str) -> uint {
|
||||
let key = key.into_ascii().to_lower().into_str();
|
||||
match mm.find_equiv(&key.as_bytes()) {
|
||||
option::None => { return 0u; }
|
||||
|
@ -85,7 +85,7 @@ fn find(mm: &HashMap<~[u8], uint>, key: ~str) -> uint {
|
|||
}
|
||||
|
||||
// given a map, increment the counter for a key
|
||||
fn update_freq(mm: &mut HashMap<~[u8], uint>, key: &[u8]) {
|
||||
fn update_freq(mm: &mut HashMap<Vec<u8> , uint>, key: &[u8]) {
|
||||
let key = key.to_owned();
|
||||
let newval = match mm.pop(&key) {
|
||||
Some(v) => v + 1,
|
||||
|
@ -97,7 +97,7 @@ fn update_freq(mm: &mut HashMap<~[u8], uint>, key: &[u8]) {
|
|||
// given a ~[u8], for each window call a function
|
||||
// i.e., for "hello" and windows of size four,
|
||||
// run it("hell") and it("ello"), then return "llo"
|
||||
fn windows_with_carry(bb: &[u8], nn: uint, it: |window: &[u8]|) -> ~[u8] {
|
||||
fn windows_with_carry(bb: &[u8], nn: uint, it: |window: &[u8]|) -> Vec<u8> {
|
||||
let mut ii = 0u;
|
||||
|
||||
let len = bb.len();
|
||||
|
@ -110,18 +110,18 @@ fn windows_with_carry(bb: &[u8], nn: uint, it: |window: &[u8]|) -> ~[u8] {
|
|||
}
|
||||
|
||||
fn make_sequence_processor(sz: uint,
|
||||
from_parent: &Receiver<~[u8]>,
|
||||
from_parent: &Receiver<Vec<u8>>,
|
||||
to_parent: &Sender<~str>) {
|
||||
let mut freqs: HashMap<~[u8], uint> = HashMap::new();
|
||||
let mut carry: ~[u8] = ~[];
|
||||
let mut freqs: HashMap<Vec<u8>, uint> = HashMap::new();
|
||||
let mut carry = Vec::new();
|
||||
let mut total: uint = 0u;
|
||||
|
||||
let mut line: ~[u8];
|
||||
let mut line: Vec<u8> ;
|
||||
|
||||
loop {
|
||||
|
||||
line = from_parent.recv();
|
||||
if line == ~[] { break; }
|
||||
if line == Vec::new() { break; }
|
||||
|
||||
carry = windows_with_carry(carry + line, sz, |window| {
|
||||
update_freq(&mut freqs, window);
|
||||
|
@ -156,9 +156,9 @@ fn main() {
|
|||
let mut rdr = BufferedReader::new(rdr);
|
||||
|
||||
// initialize each sequence sorter
|
||||
let sizes = ~[1u,2,3,4,6,12,18];
|
||||
let mut streams = slice::from_fn(sizes.len(), |_| Some(channel::<~str>()));
|
||||
let mut from_child = ~[];
|
||||
let sizes = vec!(1u,2,3,4,6,12,18);
|
||||
let mut streams = Vec::from_fn(sizes.len(), |_| Some(channel::<~str>()));
|
||||
let mut from_child = Vec::new();
|
||||
let to_child = sizes.iter().zip(streams.mut_iter()).map(|(sz, stream_ref)| {
|
||||
let sz = *sz;
|
||||
let stream = replace(stream_ref, None);
|
||||
|
@ -173,7 +173,7 @@ fn main() {
|
|||
});
|
||||
|
||||
to_child
|
||||
}).collect::<~[Sender<~[u8]>]>();
|
||||
}).collect::<Vec<Sender<Vec<u8> >> >();
|
||||
|
||||
|
||||
// latch stores true after we've started
|
||||
|
@ -215,7 +215,7 @@ fn main() {
|
|||
|
||||
// finish...
|
||||
for (ii, _sz) in sizes.iter().enumerate() {
|
||||
to_child[ii].send(~[]);
|
||||
to_child[ii].send(Vec::new());
|
||||
}
|
||||
|
||||
// now fetch and print result messages
|
||||
|
|
|
@ -50,7 +50,7 @@ impl Code {
|
|||
// FIXME: Inefficient.
|
||||
fn unpack(&self, frame: i32) -> ~str {
|
||||
let mut key = self.hash();
|
||||
let mut result = ~[];
|
||||
let mut result = Vec::new();
|
||||
for _ in range(0, frame) {
|
||||
result.push(unpack_symbol((key as u8) & 3));
|
||||
key >>= 2;
|
||||
|
@ -92,8 +92,7 @@ struct Entry {
|
|||
|
||||
struct Table {
|
||||
count: i32,
|
||||
items: ~[Option<~Entry>]
|
||||
}
|
||||
items: Vec<Option<~Entry>> }
|
||||
|
||||
struct Items<'a> {
|
||||
cur: Option<&'a Entry>,
|
||||
|
@ -237,7 +236,7 @@ fn generate_frequencies(frequencies: &mut Table,
|
|||
}
|
||||
|
||||
fn print_frequencies(frequencies: &Table, frame: i32) {
|
||||
let mut vector = ~[];
|
||||
let mut vector = Vec::new();
|
||||
for entry in frequencies.iter() {
|
||||
vector.push((entry.code, entry.count));
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ impl<'a, T> Iterator<&'a T> for ListIterator<'a, T> {
|
|||
// corresponding mirrored piece), with, as minimum coordinates, (0,
|
||||
// 0). If all is false, only generate half of the possibilities (used
|
||||
// to break the symetry of the board).
|
||||
fn transform(piece: ~[(int, int)], all: bool) -> ~[~[(int, int)]] {
|
||||
fn transform(piece: Vec<(int, int)> , all: bool) -> vec!(Vec<(int, int)> ) {
|
||||
let mut res =
|
||||
// rotations
|
||||
iterate(piece, |rot| rot.iter().map(|&(y, x)| (x + y, -y)).collect())
|
||||
|
@ -107,25 +107,25 @@ fn mask(dy: int, dx: int, id: uint, p: &[(int, int)]) -> Option<u64> {
|
|||
// Makes every possible masks. masks[id][i] correspond to every
|
||||
// possible masks for piece with identifier id with minimum coordinate
|
||||
// (i/5, i%5).
|
||||
fn make_masks() -> ~[~[~[u64]]] {
|
||||
let pieces = ~[
|
||||
~[(0,0),(0,1),(0,2),(0,3),(1,3)],
|
||||
~[(0,0),(0,2),(0,3),(1,0),(1,1)],
|
||||
~[(0,0),(0,1),(0,2),(1,2),(2,1)],
|
||||
~[(0,0),(0,1),(0,2),(1,1),(2,1)],
|
||||
~[(0,0),(0,2),(1,0),(1,1),(2,1)],
|
||||
~[(0,0),(0,1),(0,2),(1,1),(1,2)],
|
||||
~[(0,0),(0,1),(1,1),(1,2),(2,1)],
|
||||
~[(0,0),(0,1),(0,2),(1,0),(1,2)],
|
||||
~[(0,0),(0,1),(0,2),(1,2),(1,3)],
|
||||
~[(0,0),(0,1),(0,2),(0,3),(1,2)]];
|
||||
let mut res = ~[];
|
||||
fn make_masks() -> Vec<Vec<Vec<u64> > > {
|
||||
let pieces = vec!(
|
||||
vec!((0,0),(0,1),(0,2),(0,3),(1,3)),
|
||||
vec!((0,0),(0,2),(0,3),(1,0),(1,1)),
|
||||
vec!((0,0),(0,1),(0,2),(1,2),(2,1)),
|
||||
vec!((0,0),(0,1),(0,2),(1,1),(2,1)),
|
||||
vec!((0,0),(0,2),(1,0),(1,1),(2,1)),
|
||||
vec!((0,0),(0,1),(0,2),(1,1),(1,2)),
|
||||
vec!((0,0),(0,1),(1,1),(1,2),(2,1)),
|
||||
vec!((0,0),(0,1),(0,2),(1,0),(1,2)),
|
||||
vec!((0,0),(0,1),(0,2),(1,2),(1,3)),
|
||||
vec!((0,0),(0,1),(0,2),(0,3),(1,2)));
|
||||
let mut res = Vec::new();
|
||||
for (id, p) in pieces.move_iter().enumerate() {
|
||||
// To break the central symetry of the problem, every
|
||||
// transformation must be taken except for one piece (piece 3
|
||||
// here).
|
||||
let trans = transform(p, id != 3);
|
||||
let mut cur_piece = ~[];
|
||||
let mut cur_piece = Vec::new();
|
||||
for dy in range(0, 10) {
|
||||
for dx in range(0, 5) {
|
||||
let masks =
|
||||
|
@ -142,7 +142,7 @@ fn make_masks() -> ~[~[~[u64]]] {
|
|||
|
||||
// Check if all coordinates can be covered by an unused piece and that
|
||||
// all unused piece can be placed on the board.
|
||||
fn is_board_unfeasible(board: u64, masks: &[~[~[u64]]]) -> bool {
|
||||
fn is_board_unfeasible(board: u64, masks: &[Vec<Vec<u64> > ]) -> bool {
|
||||
let mut coverable = board;
|
||||
for i in range(0, 50).filter(|&i| board & 1 << i == 0) {
|
||||
for (cur_id, pos_masks) in masks.iter().enumerate() {
|
||||
|
@ -159,7 +159,7 @@ fn is_board_unfeasible(board: u64, masks: &[~[~[u64]]]) -> bool {
|
|||
}
|
||||
|
||||
// Filter the masks that we can prove to result to unfeasible board.
|
||||
fn filter_masks(masks: &[~[~[u64]]]) -> ~[~[~[u64]]] {
|
||||
fn filter_masks(masks: &[Vec<Vec<u64> > ]) -> Vec<Vec<Vec<u64> > > {
|
||||
masks.iter().map(
|
||||
|p| p.iter().map(
|
||||
|p| p.iter()
|
||||
|
@ -180,7 +180,7 @@ fn get_id(m: u64) -> u8 {
|
|||
|
||||
// Converts a list of mask to a ~str.
|
||||
fn to_utf8(raw_sol: &List<u64>) -> ~str {
|
||||
let mut sol: ~[u8] = std::slice::from_elem(50, '.' as u8);
|
||||
let mut sol: Vec<u8> = Vec::from_elem(50, '.' as u8);
|
||||
for &m in raw_sol.iter() {
|
||||
let id = get_id(m);
|
||||
for i in range(0, 50) {
|
||||
|
@ -237,7 +237,7 @@ fn handle_sol(raw_sol: &List<u64>, data: &mut Data) -> bool {
|
|||
// Search for every solutions. Returns false if the search was
|
||||
// stopped before the end.
|
||||
fn search(
|
||||
masks: &[~[~[u64]]],
|
||||
masks: &[Vec<Vec<u64> > ],
|
||||
board: u64,
|
||||
mut i: int,
|
||||
cur: List<u64>,
|
||||
|
|
|
@ -148,9 +148,9 @@ fn offset_momentum(bodies: &mut [Planet, ..N_BODIES]) {
|
|||
fn main() {
|
||||
let args = os::args();
|
||||
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||
~[~"", ~"1000"]
|
||||
vec!(~"", ~"1000")
|
||||
} else if args.len() <= 1u {
|
||||
~[~"", ~"1000"]
|
||||
vec!(~"", ~"1000")
|
||||
} else {
|
||||
args
|
||||
};
|
||||
|
|
|
@ -51,8 +51,8 @@ struct Config {
|
|||
stress: bool
|
||||
}
|
||||
|
||||
fn parse_opts(argv: ~[~str]) -> Config {
|
||||
let opts = ~[getopts::optflag("", "stress", "")];
|
||||
fn parse_opts(argv: Vec<~str> ) -> Config {
|
||||
let opts = vec!(getopts::optflag("", "stress", ""));
|
||||
|
||||
let opt_args = argv.slice(1, argv.len());
|
||||
|
||||
|
@ -75,7 +75,7 @@ fn stress_task(id: int) {
|
|||
}
|
||||
|
||||
fn stress(num_tasks: int) {
|
||||
let mut results = ~[];
|
||||
let mut results = Vec::new();
|
||||
for i in range(0, num_tasks) {
|
||||
let mut builder = task::task();
|
||||
results.push(builder.future_result());
|
||||
|
@ -91,9 +91,9 @@ fn stress(num_tasks: int) {
|
|||
fn main() {
|
||||
let args = os::args();
|
||||
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||
~[~"", ~"20"]
|
||||
vec!(~"", ~"20")
|
||||
} else if args.len() <= 1u {
|
||||
~[~"", ~"8"]
|
||||
vec!(~"", ~"8")
|
||||
} else {
|
||||
args
|
||||
};
|
||||
|
|
|
@ -29,8 +29,10 @@ fn dot(v: &[f64], u: &[f64]) -> f64 {
|
|||
sum
|
||||
}
|
||||
|
||||
fn mult(v: RWArc<~[f64]>, out: RWArc<~[f64]>, f: fn(&~[f64], uint) -> f64) {
|
||||
// We lanch in different tasks the work to be done. To finish
|
||||
fn mult(v: RWArc<Vec<f64>>,
|
||||
out: RWArc<Vec<f64>>,
|
||||
f: fn(&Vec<f64>, uint) -> f64) {
|
||||
// We launch in different tasks the work to be done. To finish
|
||||
// this fuction, we need to wait for the completion of every
|
||||
// tasks. To do that, we give to each tasks a wait_chan that we
|
||||
// drop at the end of the work. At the end of this function, we
|
||||
|
@ -58,7 +60,7 @@ fn mult(v: RWArc<~[f64]>, out: RWArc<~[f64]>, f: fn(&~[f64], uint) -> f64) {
|
|||
for () in rx.iter() {}
|
||||
}
|
||||
|
||||
fn mult_Av_impl(v: &~[f64], i: uint) -> f64 {
|
||||
fn mult_Av_impl(v: &Vec<f64> , i: uint) -> f64 {
|
||||
let mut sum = 0.;
|
||||
for (j, &v_j) in v.iter().enumerate() {
|
||||
sum += v_j / A(i, j);
|
||||
|
@ -66,11 +68,11 @@ fn mult_Av_impl(v: &~[f64], i: uint) -> f64 {
|
|||
sum
|
||||
}
|
||||
|
||||
fn mult_Av(v: RWArc<~[f64]>, out: RWArc<~[f64]>) {
|
||||
fn mult_Av(v: RWArc<Vec<f64> >, out: RWArc<Vec<f64> >) {
|
||||
mult(v, out, mult_Av_impl);
|
||||
}
|
||||
|
||||
fn mult_Atv_impl(v: &~[f64], i: uint) -> f64 {
|
||||
fn mult_Atv_impl(v: &Vec<f64> , i: uint) -> f64 {
|
||||
let mut sum = 0.;
|
||||
for (j, &v_j) in v.iter().enumerate() {
|
||||
sum += v_j / A(j, i);
|
||||
|
@ -78,11 +80,11 @@ fn mult_Atv_impl(v: &~[f64], i: uint) -> f64 {
|
|||
sum
|
||||
}
|
||||
|
||||
fn mult_Atv(v: RWArc<~[f64]>, out: RWArc<~[f64]>) {
|
||||
fn mult_Atv(v: RWArc<Vec<f64> >, out: RWArc<Vec<f64> >) {
|
||||
mult(v, out, mult_Atv_impl);
|
||||
}
|
||||
|
||||
fn mult_AtAv(v: RWArc<~[f64]>, out: RWArc<~[f64]>, tmp: RWArc<~[f64]>) {
|
||||
fn mult_AtAv(v: RWArc<Vec<f64> >, out: RWArc<Vec<f64> >, tmp: RWArc<Vec<f64> >) {
|
||||
mult_Av(v, tmp.clone());
|
||||
mult_Atv(tmp, out);
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ fn main() {
|
|||
use std::from_str::FromStr;
|
||||
|
||||
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||
~[~"", ~"2000000", ~"503"]
|
||||
vec!(~"", ~"2000000", ~"503")
|
||||
}
|
||||
else {
|
||||
os::args()
|
||||
|
|
|
@ -32,9 +32,9 @@ fn check_sequential(min: uint, max: uint, map: &SmallIntMap<uint>) {
|
|||
fn main() {
|
||||
let args = os::args();
|
||||
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||
~[~"", ~"100000", ~"100"]
|
||||
vec!(~"", ~"100000", ~"100")
|
||||
} else if args.len() <= 1u {
|
||||
~[~"", ~"10000", ~"50"]
|
||||
vec!(~"", ~"10000", ~"50")
|
||||
} else {
|
||||
args
|
||||
};
|
||||
|
|
|
@ -36,7 +36,7 @@ use std::slice;
|
|||
//
|
||||
|
||||
// internal type of sudoku grids
|
||||
type grid = ~[~[u8]];
|
||||
type grid = Vec<Vec<u8> > ;
|
||||
|
||||
struct Sudoku {
|
||||
grid: grid
|
||||
|
@ -68,9 +68,9 @@ impl Sudoku {
|
|||
pub fn read(mut reader: BufferedReader<StdReader>) -> Sudoku {
|
||||
assert!(reader.read_line().unwrap() == ~"9,9"); /* assert first line is exactly "9,9" */
|
||||
|
||||
let mut g = slice::from_fn(10u, { |_i| ~[0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8] });
|
||||
let mut g = slice::from_fn(10u, { |_i| vec!(0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8) });
|
||||
for line in reader.lines() {
|
||||
let comps: ~[&str] = line.unwrap().trim().split(',').collect();
|
||||
let comps: Vec<&str> = line.trim().split(',').collect();
|
||||
|
||||
if comps.len() == 3u {
|
||||
let row = from_str::<uint>(comps[0]).unwrap() as u8;
|
||||
|
@ -96,7 +96,7 @@ impl Sudoku {
|
|||
|
||||
// solve sudoku grid
|
||||
pub fn solve(&mut self) {
|
||||
let mut work: ~[(u8, u8)] = ~[]; /* queue of uncolored fields */
|
||||
let mut work: Vec<(u8, u8)> = Vec::new(); /* queue of uncolored fields */
|
||||
for row in range(0u8, 9u8) {
|
||||
for col in range(0u8, 9u8) {
|
||||
let color = self.grid[row][col];
|
||||
|
|
|
@ -50,7 +50,7 @@ struct State {
|
|||
managed: @nillist,
|
||||
unique: ~nillist,
|
||||
tuple: (@nillist, ~nillist),
|
||||
vec: ~[@nillist],
|
||||
vec: vec!(@nillist),
|
||||
res: r
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ fn recurse_or_fail(depth: int, st: Option<State>) {
|
|||
managed: @Nil,
|
||||
unique: ~Nil,
|
||||
tuple: (@Nil, ~Nil),
|
||||
vec: ~[@Nil],
|
||||
vec: vec!(@Nil),
|
||||
res: r(@Nil)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,9 +41,9 @@ fn child_generation(gens_left: uint, tx: comm::Sender<()>) {
|
|||
fn main() {
|
||||
let args = os::args();
|
||||
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||
~[~"", ~"100000"]
|
||||
vec!(~"", ~"100000")
|
||||
} else if args.len() <= 1 {
|
||||
~[~"", ~"100"]
|
||||
vec!(~"", ~"100")
|
||||
} else {
|
||||
args.clone()
|
||||
};
|
||||
|
|
|
@ -19,7 +19,7 @@ use std::slice;
|
|||
|
||||
fn calc(children: uint, parent_wait_chan: &Sender<Sender<Sender<int>>>) {
|
||||
|
||||
let wait_ports: ~[Receiver<Sender<Sender<int>>>] = slice::from_fn(children, |_| {
|
||||
let wait_ports: Vec<Reciever<Sender<Sender<int>>>> = vec::from_fn(children, |_| {
|
||||
let (wait_port, wait_chan) = stream::<Sender<Sender<int>>>();
|
||||
task::spawn(proc() {
|
||||
calc(children / 2, &wait_chan);
|
||||
|
@ -27,14 +27,14 @@ fn calc(children: uint, parent_wait_chan: &Sender<Sender<Sender<int>>>) {
|
|||
wait_port
|
||||
});
|
||||
|
||||
let child_start_chans: ~[Sender<Sender<int>>] =
|
||||
let child_start_chans: Vec<Sender<Sender<int>>> =
|
||||
wait_ports.move_iter().map(|port| port.recv()).collect();
|
||||
|
||||
let (start_port, start_chan) = stream::<Sender<int>>();
|
||||
parent_wait_chan.send(start_chan);
|
||||
let parent_result_chan: Sender<int> = start_port.recv();
|
||||
|
||||
let child_sum_ports: ~[Receiver<int>] =
|
||||
let child_sum_ports: Vec<Reciever<int>> =
|
||||
child_start_chans.move_iter().map(|child_start_chan| {
|
||||
let (child_sum_port, child_sum_chan) = stream::<int>();
|
||||
child_start_chan.send(child_sum_chan);
|
||||
|
@ -49,9 +49,9 @@ fn calc(children: uint, parent_wait_chan: &Sender<Sender<Sender<int>>>) {
|
|||
fn main() {
|
||||
let args = os::args();
|
||||
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||
~[~"", ~"30"]
|
||||
vec!(~"", ~"30")
|
||||
} else if args.len() <= 1u {
|
||||
~[~"", ~"10"]
|
||||
vec!(~"", ~"10")
|
||||
} else {
|
||||
args
|
||||
};
|
||||
|
|
|
@ -25,9 +25,9 @@ fn g() { }
|
|||
fn main() {
|
||||
let args = os::args();
|
||||
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||
~[~"", ~"400"]
|
||||
vec!(~"", ~"400")
|
||||
} else if args.len() <= 1u {
|
||||
~[~"", ~"10"]
|
||||
vec!(~"", ~"10")
|
||||
} else {
|
||||
args
|
||||
};
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
// except according to those terms.
|
||||
|
||||
|
||||
struct sty(~[int]);
|
||||
struct sty(Vec<int> );
|
||||
|
||||
fn unpack(_unpack: |v: &sty| -> ~[int]) {}
|
||||
fn unpack(_unpack: |v: &sty| -> Vec<int> ) {}
|
||||
|
||||
fn main() {
|
||||
let _foo = unpack(|s| {
|
||||
|
|
|
@ -12,15 +12,15 @@ trait foo {
|
|||
fn foo(&self) -> int;
|
||||
}
|
||||
|
||||
impl foo for ~[uint] {
|
||||
impl foo for Vec<uint> {
|
||||
fn foo(&self) -> int {1} //~ NOTE candidate #1 is `~[uint].foo::foo`
|
||||
}
|
||||
|
||||
impl foo for ~[int] {
|
||||
impl foo for Vec<int> {
|
||||
fn foo(&self) -> int {2} //~ NOTE candidate #2 is `~[int].foo::foo`
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let x = ~[];
|
||||
let x = Vec::new();
|
||||
x.foo(); //~ ERROR multiple applicable methods in scope
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ fn main() {
|
|||
// reference. That would allow creating a mutable pointer to a
|
||||
// temporary, which would be a source of confusion
|
||||
|
||||
let mut a = ~[0];
|
||||
let mut a = vec!(0);
|
||||
a.test_mut(); //~ ERROR does not implement any method in scope named `test_mut`
|
||||
}
|
||||
|
||||
|
|
|
@ -12,4 +12,4 @@
|
|||
|
||||
mod m1 {}
|
||||
|
||||
fn main(args: ~[str]) { log(debug, m1::a); }
|
||||
fn main(args: vec!(str)) { log(debug, m1::a); }
|
||||
|
|
|
@ -14,4 +14,4 @@ mod m1 {
|
|||
pub mod a {}
|
||||
}
|
||||
|
||||
fn main(args: ~[str]) { log(debug, m1::a); }
|
||||
fn main(args: vec!(str)) { log(debug, m1::a); }
|
||||
|
|
|
@ -10,4 +10,4 @@
|
|||
|
||||
// error-pattern: unresolved name
|
||||
|
||||
fn main() { let foo = thing::len(~[]); }
|
||||
fn main() { let foo = thing::len(Vec::new()); }
|
||||
|
|
|
@ -14,7 +14,7 @@ struct Point {
|
|||
}
|
||||
|
||||
fn a() {
|
||||
let mut p = ~[1];
|
||||
let mut p = vec!(1);
|
||||
|
||||
// Create an immutable pointer into p's contents:
|
||||
let q: &int = &p[0];
|
||||
|
@ -30,7 +30,7 @@ fn b() {
|
|||
// here we alias the mutable vector into an imm slice and try to
|
||||
// modify the original:
|
||||
|
||||
let mut p = ~[1];
|
||||
let mut p = vec!(1);
|
||||
|
||||
borrow(
|
||||
p,
|
||||
|
@ -40,7 +40,7 @@ fn b() {
|
|||
fn c() {
|
||||
// Legal because the scope of the borrow does not include the
|
||||
// modification:
|
||||
let mut p = ~[1];
|
||||
let mut p = vec!(1);
|
||||
borrow(p, ||{});
|
||||
p[0] = 5;
|
||||
}
|
||||
|
|
|
@ -28,6 +28,6 @@ fn defer<'r>(x: &'r [&'r str]) -> defer<'r> {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
let x = defer(~["Goodbye", "world!"]); //~ ERROR borrowed value does not live long enough
|
||||
let x = defer(vec!("Goodbye", "world!")); //~ ERROR borrowed value does not live long enough
|
||||
x.x[0];
|
||||
}
|
||||
|
|
|
@ -17,12 +17,12 @@ fn takes_imm_elt(_v: &int, f: ||) {
|
|||
}
|
||||
|
||||
fn has_mut_vec_and_does_not_try_to_change_it() {
|
||||
let mut v = ~[1, 2, 3];
|
||||
let mut v = vec!(1, 2, 3);
|
||||
takes_imm_elt(&v[0], || {})
|
||||
}
|
||||
|
||||
fn has_mut_vec_but_tries_to_change_it() {
|
||||
let mut v = ~[1, 2, 3];
|
||||
let mut v = vec!(1, 2, 3);
|
||||
takes_imm_elt(
|
||||
&v[0],
|
||||
|| { //~ ERROR cannot borrow `v` as mutable
|
||||
|
|
|
@ -16,11 +16,11 @@ struct Foo {
|
|||
}
|
||||
|
||||
pub fn main() {
|
||||
let x = ~[
|
||||
let x = vec!(
|
||||
Foo { string: ~"foo" },
|
||||
Foo { string: ~"bar" },
|
||||
Foo { string: ~"baz" }
|
||||
];
|
||||
);
|
||||
let x: &[Foo] = x;
|
||||
match x {
|
||||
[_, ..tail] => {
|
||||
|
|
|
@ -13,6 +13,6 @@ fn write(v: &mut [int]) {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
let v = ~[1, 2, 3];
|
||||
let v = vec!(1, 2, 3);
|
||||
write(v); //~ ERROR cannot borrow
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
fn a() -> &[int] {
|
||||
let vec = ~[1, 2, 3, 4];
|
||||
let vec = vec!(1, 2, 3, 4);
|
||||
let vec: &[int] = vec; //~ ERROR does not live long enough
|
||||
let tail = match vec {
|
||||
[_, ..tail] => tail,
|
||||
|
@ -19,7 +19,7 @@ fn a() -> &[int] {
|
|||
}
|
||||
|
||||
fn b() -> &[int] {
|
||||
let vec = ~[1, 2, 3, 4];
|
||||
let vec = vec!(1, 2, 3, 4);
|
||||
let vec: &[int] = vec; //~ ERROR does not live long enough
|
||||
let init = match vec {
|
||||
[..init, _] => init,
|
||||
|
@ -29,7 +29,7 @@ fn b() -> &[int] {
|
|||
}
|
||||
|
||||
fn c() -> &[int] {
|
||||
let vec = ~[1, 2, 3, 4];
|
||||
let vec = vec!(1, 2, 3, 4);
|
||||
let vec: &[int] = vec; //~ ERROR does not live long enough
|
||||
let slice = match vec {
|
||||
[_, ..slice, _] => slice,
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
fn a() {
|
||||
let mut v = ~[1, 2, 3];
|
||||
let mut v = vec!(1, 2, 3);
|
||||
let vb: &mut [int] = v;
|
||||
match vb {
|
||||
[_a, ..tail] => {
|
||||
|
|
|
@ -18,7 +18,7 @@ fn a() {
|
|||
}
|
||||
|
||||
fn b() {
|
||||
let mut vec = ~[~1, ~2, ~3];
|
||||
let mut vec = vec!(~1, ~2, ~3);
|
||||
let vec: &mut [~int] = vec;
|
||||
match vec {
|
||||
[.._b] => {
|
||||
|
@ -28,7 +28,7 @@ fn b() {
|
|||
}
|
||||
|
||||
fn c() {
|
||||
let mut vec = ~[~1, ~2, ~3];
|
||||
let mut vec = vec!(~1, ~2, ~3);
|
||||
let vec: &mut [~int] = vec;
|
||||
match vec {
|
||||
[_a, .._b] => {
|
||||
|
@ -46,7 +46,7 @@ fn c() {
|
|||
}
|
||||
|
||||
fn d() {
|
||||
let mut vec = ~[~1, ~2, ~3];
|
||||
let mut vec = vec!(~1, ~2, ~3);
|
||||
let vec: &mut [~int] = vec;
|
||||
match vec {
|
||||
[.._a, _b] => {
|
||||
|
@ -58,7 +58,7 @@ fn d() {
|
|||
}
|
||||
|
||||
fn e() {
|
||||
let mut vec = ~[~1, ~2, ~3];
|
||||
let mut vec = vec!(~1, ~2, ~3);
|
||||
let vec: &mut [~int] = vec;
|
||||
match vec {
|
||||
[_a, _b, _c] => {} //~ ERROR cannot move out
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
fn a() -> &int {
|
||||
let vec = ~[1, 2, 3, 4];
|
||||
let vec = vec!(1, 2, 3, 4);
|
||||
let vec: &[int] = vec; //~ ERROR `vec[..]` does not live long enough
|
||||
let tail = match vec {
|
||||
[_a, ..tail] => &tail[0],
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
#[feature(managed_boxes)];
|
||||
|
||||
type Foo = ~[u8];
|
||||
type Foo = Vec<u8> ;
|
||||
|
||||
impl Drop for Foo { //~ ERROR the Drop trait may only be implemented
|
||||
//~^ ERROR cannot provide an extension implementation
|
||||
|
|
|
@ -9,5 +9,5 @@
|
|||
// except according to those terms.
|
||||
|
||||
fn main() {
|
||||
let v = ~[,]; //~ ERROR unexpected token: `,`
|
||||
let v = vec!(); //~ ERROR unexpected token: `,`
|
||||
}
|
||||
|
|
|
@ -10,10 +10,10 @@
|
|||
|
||||
#[feature(managed_boxes)];
|
||||
|
||||
fn wants_uniq(x: ~[uint]) { }
|
||||
fn wants_uniq(x: Vec<uint> ) { }
|
||||
fn wants_three(x: [uint, ..3]) { }
|
||||
|
||||
fn has_uniq(x: ~[uint]) {
|
||||
fn has_uniq(x: Vec<uint> ) {
|
||||
wants_uniq(x);
|
||||
wants_three(x); //~ ERROR [] storage differs: expected `3` but found `~`
|
||||
}
|
||||
|
|
|
@ -14,4 +14,4 @@ use zed::baz;
|
|||
mod zed {
|
||||
pub fn bar() { println!("bar"); }
|
||||
}
|
||||
fn main(args: ~[str]) { bar(); }
|
||||
fn main(args: vec!(str)) { bar(); }
|
||||
|
|
|
@ -15,4 +15,4 @@ mod baz {}
|
|||
mod zed {
|
||||
pub fn bar() { println!("bar3"); }
|
||||
}
|
||||
fn main(args: ~[str]) { bar(); }
|
||||
fn main(args: vec!(str)) { bar(); }
|
||||
|
|
|
@ -11,4 +11,4 @@
|
|||
// error-pattern: unresolved
|
||||
use main::bar;
|
||||
|
||||
fn main(args: ~[str]) { println!("foo"); }
|
||||
fn main() { println!("foo"); }
|
||||
|
|
|
@ -13,4 +13,4 @@
|
|||
mod a { pub use b::foo; }
|
||||
mod b { pub use a::foo; }
|
||||
|
||||
fn main(args: ~[str]) { println!("loop"); }
|
||||
fn main() { println!("loop"); }
|
||||
|
|
|
@ -10,6 +10,6 @@
|
|||
|
||||
// error-pattern: illegal recursive type
|
||||
|
||||
type x = ~[x];
|
||||
type x = vec!(x);
|
||||
|
||||
fn main() { let b: x = ~[]; }
|
||||
fn main() { let b: x = Vec::new(); }
|
||||
|
|
|
@ -10,13 +10,13 @@
|
|||
|
||||
|
||||
trait Serializable<'self, T> { //~ ERROR: no longer a special lifetime
|
||||
fn serialize(val : &'self T) -> ~[u8];
|
||||
fn serialize(val : &'self T) -> Vec<u8> ;
|
||||
fn deserialize(repr : &[u8]) -> &'self T;
|
||||
}
|
||||
|
||||
impl<'self> Serializable<str> for &'self str {
|
||||
fn serialize(val : &'self str) -> ~[u8] {
|
||||
~[1]
|
||||
fn serialize(val : &'self str) -> Vec<u8> {
|
||||
vec!(1)
|
||||
}
|
||||
fn deserialize(repr: &[u8]) -> &'self str {
|
||||
"hi"
|
||||
|
|
|
@ -10,6 +10,6 @@
|
|||
|
||||
#[feature(managed_boxes)];
|
||||
|
||||
static x: ~[int] = ~[123, 456]; //~ ERROR: static items are not allowed to have owned pointers
|
||||
static x: Vec<int> = vec!(123, 456); //~ ERROR: static items are not allowed to have owned pointers
|
||||
|
||||
fn main() {}
|
||||
|
|
|
@ -10,12 +10,12 @@
|
|||
|
||||
// error-pattern:expected `[` but found `~`
|
||||
mod blade_runner {
|
||||
#~[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."
|
||||
)]
|
||||
))
|
||||
}
|
||||
|
|
|
@ -9,11 +9,11 @@
|
|||
// except according to those terms.
|
||||
|
||||
trait vec_monad<A> {
|
||||
fn bind<B>(&self, f: |A| -> ~[B]);
|
||||
fn bind<B>(&self, f: |A| -> Vec<B> );
|
||||
}
|
||||
|
||||
impl<A> vec_monad<A> for ~[A] {
|
||||
fn bind<B>(&self, f: |A| -> ~[B]) {
|
||||
impl<A> vec_monad<A> for Vec<A> {
|
||||
fn bind<B>(&self, f: |A| -> Vec<B> ) {
|
||||
let mut r = fail!();
|
||||
for elt in self.iter() { r = r + f(*elt); }
|
||||
//~^ ERROR the type of this value must be known
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#[allow(dead_code)];
|
||||
#[allow(deprecated_owned_vector)];
|
||||
|
||||
fn fail_len(v: ~[int]) -> uint {
|
||||
fn fail_len(v: Vec<int> ) -> uint {
|
||||
let mut i = 3;
|
||||
fail!();
|
||||
for x in v.iter() { i += 1u; }
|
||||
|
|
|
@ -10,4 +10,4 @@
|
|||
|
||||
// error-pattern: unresolved name `foobar`.
|
||||
|
||||
fn main(args: ~[str]) { println!("{:?}", foobar); }
|
||||
fn main() { println!("{:?}", foobar); }
|
||||
|
|
|
@ -38,8 +38,8 @@ fn main() {
|
|||
{
|
||||
let mut res = foo(x);
|
||||
|
||||
let mut v = ~[];
|
||||
v = ~[(res)] + v; //~ failed to find an implementation of trait
|
||||
let mut v = Vec::new();
|
||||
v = vec!((res)) + v; //~ failed to find an implementation of trait
|
||||
assert_eq!(v.len(), 2);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,15 +9,15 @@
|
|||
// except according to those terms.
|
||||
|
||||
struct parser {
|
||||
tokens: ~[int],
|
||||
tokens: Vec<int> ,
|
||||
}
|
||||
|
||||
trait parse {
|
||||
fn parse(&self) -> ~[int];
|
||||
fn parse(&self) -> Vec<int> ;
|
||||
}
|
||||
|
||||
impl parse for parser {
|
||||
fn parse(&self) -> ~[int] {
|
||||
fn parse(&self) -> Vec<int> {
|
||||
self.tokens //~ ERROR cannot move out of dereference of `&`-pointer
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
fn main() {
|
||||
let needlesArr: ~[char] = ~['a', 'f'];
|
||||
let needlesArr: Vec<char> = vec!('a', 'f');
|
||||
needlesArr.iter().fold(|x, y| {
|
||||
});
|
||||
//~^^ ERROR this function takes 2 parameters but 1 parameter was supplied
|
||||
|
|
|
@ -23,7 +23,7 @@ impl CrateId {
|
|||
}
|
||||
|
||||
pub fn remove_package_from_database() {
|
||||
let mut lines_to_use: ~[&CrateId] = ~[]; //~ ERROR cannot infer an appropriate lifetime
|
||||
let mut lines_to_use: Vec<&CrateId> = Vec::new(); //~ ERROR cannot infer an appropriate lifetime
|
||||
let push_id = |installed_id: &CrateId| {
|
||||
lines_to_use.push(installed_id);
|
||||
};
|
||||
|
|
|
@ -15,15 +15,15 @@
|
|||
|
||||
struct Data(~Option<Data>);
|
||||
|
||||
fn generic<T>( _ : ~[(Data,T)] ) {
|
||||
fn generic<T>( _ : Vec<(Data,T)> ) {
|
||||
//~^ ERROR reached the recursion limit during monomorphization
|
||||
let rec : ~[(Data,(bool,T))] = ~[];
|
||||
let rec : Vec<(Data,(bool,T))> = Vec::new();
|
||||
generic( rec );
|
||||
}
|
||||
|
||||
|
||||
fn main () {
|
||||
// Use generic<T> at least once to trigger instantiation.
|
||||
let input : ~[(Data,())] = ~[];
|
||||
let input : Vec<(Data,())> = Vec::new();
|
||||
generic(input);
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ fn test<'a,T,U:Freeze>(_: &'a int) {
|
|||
// ~ pointers are ok
|
||||
assert_freeze::<~int>();
|
||||
assert_freeze::<~str>();
|
||||
assert_freeze::<~[int]>();
|
||||
assert_freeze::<Vec<int> >();
|
||||
|
||||
// but not if they own a bad thing
|
||||
assert_freeze::<~&'a mut int>(); //~ ERROR does not fulfill `Freeze`
|
||||
|
|
|
@ -40,7 +40,7 @@ fn test<'a,T,U:Pod>(_: &'a int) {
|
|||
// ~ pointers are not ok
|
||||
assert_pod::<~int>(); //~ ERROR does not fulfill `Pod`
|
||||
assert_pod::<~str>(); //~ ERROR does not fulfill `Pod`
|
||||
assert_pod::<~[int]>(); //~ ERROR does not fulfill `Pod`
|
||||
assert_pod::<Vec<int> >(); //~ ERROR does not fulfill `Pod`
|
||||
assert_pod::<~&'a mut int>(); //~ ERROR does not fulfill `Pod`
|
||||
|
||||
// borrowed object types are generally ok
|
||||
|
|
|
@ -30,7 +30,7 @@ fn test<'a,T,U:Send>(_: &'a int) {
|
|||
// ~ pointers are ok
|
||||
assert_send::<~int>();
|
||||
assert_send::<~str>();
|
||||
assert_send::<~[int]>();
|
||||
assert_send::<Vec<int> >();
|
||||
|
||||
// but not if they own a bad thing
|
||||
assert_send::<~&'a int>(); //~ ERROR does not fulfill `Send`
|
||||
|
|
|
@ -25,7 +25,7 @@ fn main() {
|
|||
@2; //~ ERROR type uses managed
|
||||
|
||||
~2; //~ ERROR type uses owned
|
||||
~[1]; //~ ERROR type uses owned
|
||||
vec!(1); //~ ERROR type uses owned
|
||||
//~^ ERROR type uses owned
|
||||
fn g(_: ~Clone) {} //~ ERROR type uses owned
|
||||
~""; //~ ERROR type uses owned
|
||||
|
|
|
@ -21,7 +21,7 @@ fn main() {
|
|||
let mut a = 3; //~ ERROR: variable does not need to be mutable
|
||||
let mut a = 2; //~ ERROR: variable does not need to be mutable
|
||||
let mut b = 3; //~ ERROR: variable does not need to be mutable
|
||||
let mut a = ~[3]; //~ ERROR: variable does not need to be mutable
|
||||
let mut a = vec!(3); //~ ERROR: variable does not need to be mutable
|
||||
let (mut a, b) = (1, 2); //~ ERROR: variable does not need to be mutable
|
||||
|
||||
match 30 {
|
||||
|
@ -34,9 +34,9 @@ fn main() {
|
|||
// positive cases
|
||||
let mut a = 2;
|
||||
a = 3;
|
||||
let mut a = ~[];
|
||||
let mut a = Vec::new();
|
||||
a.push(3);
|
||||
let mut a = ~[];
|
||||
let mut a = Vec::new();
|
||||
callback(|| {
|
||||
a.push(3);
|
||||
});
|
||||
|
@ -63,5 +63,5 @@ fn callback(f: ||) {}
|
|||
#[allow(unused_mut)]
|
||||
fn foo(mut a: int) {
|
||||
let mut a = 3;
|
||||
let mut b = ~[2];
|
||||
let mut b = vec!(2);
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ fn good2() {
|
|||
sure that when purity is inherited that the source of the unsafe-ness
|
||||
is tracked correctly */
|
||||
unsafe {
|
||||
unsafe fn what() -> ~[~str] { fail!() }
|
||||
unsafe fn what() -> Vec<~str> { fail!() }
|
||||
|
||||
callback(|| {
|
||||
what();
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
use std::slice;
|
||||
|
||||
fn main() {
|
||||
let a: ~[int] = ~[];
|
||||
let a: Vec<int> = Vec::new();
|
||||
a.iter().advance(|_| -> bool {
|
||||
//~^ ERROR mismatched types
|
||||
});
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
fn main() {
|
||||
let a = ~[];
|
||||
let a = Vec::new();
|
||||
match a {
|
||||
[1, ..tail, ..tail] => {}, //~ ERROR: unexpected token: `..`
|
||||
_ => ()
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
fn main() {
|
||||
let x: ~[(int, int)] = ~[];
|
||||
let x: Vec<(int, int)> = Vec::new();
|
||||
let x: &[(int, int)] = x;
|
||||
match x {
|
||||
[a, (2, 3), _] => (),
|
||||
|
@ -17,7 +17,7 @@ fn main() {
|
|||
_ => ()
|
||||
}
|
||||
|
||||
let x: ~[~str] = ~[~"foo", ~"bar", ~"baz"];
|
||||
let x: Vec<~str> = vec!(~"foo", ~"bar", ~"baz");
|
||||
let x: &[~str] = x;
|
||||
match x {
|
||||
[a, _, _, ..] => { println!("{}", a); }
|
||||
|
@ -25,7 +25,7 @@ fn main() {
|
|||
_ => { }
|
||||
}
|
||||
|
||||
let x: ~[char] = ~['a', 'b', 'c'];
|
||||
let x: Vec<char> = vec!('a', 'b', 'c');
|
||||
let x: &[char] = x;
|
||||
match x {
|
||||
['a', 'b', 'c', .._tail] => {}
|
||||
|
|
|
@ -22,7 +22,7 @@ fn f10() {
|
|||
}
|
||||
|
||||
fn f20() {
|
||||
let x = ~[~"hi"];
|
||||
let x = vec!(~"hi");
|
||||
consume(x[0]);
|
||||
touch(&x[0]); //~ ERROR use of partially moved value: `x`
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ fn f20() {
|
|||
}
|
||||
|
||||
fn f21() {
|
||||
let x = ~[1, 2, 3];
|
||||
let x = vec!(1, 2, 3);
|
||||
let _y = (x[0], 3);
|
||||
touch(&x);
|
||||
}
|
||||
|
@ -78,24 +78,24 @@ fn f70() {
|
|||
|
||||
fn f80() {
|
||||
let x = ~"hi";
|
||||
let _y = ~[x];
|
||||
let _y = vec!(x);
|
||||
touch(&x); //~ ERROR use of moved value: `x`
|
||||
}
|
||||
|
||||
fn f100() {
|
||||
let x = ~[~"hi"];
|
||||
let x = vec!(~"hi");
|
||||
let _y = x[0];
|
||||
touch(&x); //~ ERROR use of partially moved value: `x`
|
||||
}
|
||||
|
||||
fn f110() {
|
||||
let x = ~[~"hi"];
|
||||
let x = vec!(~"hi");
|
||||
let _y = [x[0], ..1];
|
||||
touch(&x); //~ ERROR use of partially moved value: `x`
|
||||
}
|
||||
|
||||
fn f120() {
|
||||
let mut x = ~[~"hi", ~"ho"];
|
||||
let mut x = vec!(~"hi", ~"ho");
|
||||
x.swap(0, 1);
|
||||
touch(&x[0]);
|
||||
touch(&x[1]);
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
// error-pattern:attempt to use a type argument out of scope
|
||||
fn hd<U>(v: ~[U]) -> U {
|
||||
fn hd<U>(v: Vec<U> ) -> U {
|
||||
fn hd1(w: [U]) -> U { return w[0]; }
|
||||
|
||||
return hd1(v);
|
||||
|
|
|
@ -16,7 +16,7 @@ use sync::Arc;
|
|||
use std::task;
|
||||
|
||||
fn main() {
|
||||
let v = ~[1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
||||
let v = vec!(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
|
||||
let arc_v = Arc::new(v);
|
||||
|
||||
task::spawn(proc() {
|
||||
|
|
|
@ -14,7 +14,7 @@ use sync::Arc;
|
|||
use std::task;
|
||||
|
||||
fn main() {
|
||||
let v = ~[1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
||||
let v = vec!(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
|
||||
let arc_v = Arc::new(v);
|
||||
|
||||
task::spawn(proc() {
|
||||
|
|
|
@ -11,6 +11,6 @@
|
|||
enum State { ST_NULL, ST_WHITESPACE }
|
||||
|
||||
fn main() {
|
||||
~[ST_NULL, ..(ST_WHITESPACE as uint)];
|
||||
vec!(ST_NULL, ..(ST_WHITESPACE as uint));
|
||||
//~^ ERROR expected constant integer for repeat count but found variable
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
use std::libc;
|
||||
|
||||
fn main() {
|
||||
let x : *~[int] = &~[1,2,3];
|
||||
let x : *Vec<int> = &vec!(1,2,3);
|
||||
let y : *libc::c_void = x as *libc::c_void;
|
||||
unsafe {
|
||||
let _z = (*y).clone();
|
||||
|
|
|
@ -35,7 +35,7 @@ fn main() {
|
|||
(_, a) => {}
|
||||
(b, b) => {}
|
||||
}
|
||||
let vec = ~[Some(42), None, Some(21)];
|
||||
let vec = vec!(Some(42), None, Some(21));
|
||||
let vec: &[Option<int>] = vec;
|
||||
match vec {
|
||||
//~^ ERROR non-exhaustive patterns: vectors of length 0 not covered
|
||||
|
@ -43,13 +43,13 @@ fn main() {
|
|||
[Some(..), Some(..), ..tail] => {}
|
||||
[None] => {}
|
||||
}
|
||||
let vec = ~[1];
|
||||
let vec = vec!(1);
|
||||
let vec: &[int] = vec;
|
||||
match vec {
|
||||
[_, ..tail] => (),
|
||||
[] => ()
|
||||
}
|
||||
let vec = ~[0.5];
|
||||
let vec = vec!(0.5);
|
||||
let vec: &[f32] = vec;
|
||||
match vec { //~ ERROR non-exhaustive patterns: vectors of length 4 not covered
|
||||
[0.1, 0.2, 0.3] => (),
|
||||
|
@ -57,7 +57,7 @@ fn main() {
|
|||
[0.1] => (),
|
||||
[] => ()
|
||||
}
|
||||
let vec = ~[Some(42), None, Some(21)];
|
||||
let vec = vec!(Some(42), None, Some(21));
|
||||
let vec: &[Option<int>] = vec;
|
||||
match vec {
|
||||
[Some(..), None, ..tail] => {}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
|
||||
enum bar { t1((), Option<~[int]>), t2, }
|
||||
enum bar { t1((), Option<Vec<int>>), t2, }
|
||||
|
||||
// n.b. my change changes this error message, but I think it's right -- tjc
|
||||
fn foo(t: bar) -> int { match t { t1(_, Some(x)) => { return x * 3; } _ => { fail!(); } } }
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
// error-pattern: mismatched types
|
||||
|
||||
enum bar { t1((), Option<~[int]>), t2, }
|
||||
enum bar { t1((), Option<Vec<int> >), t2, }
|
||||
|
||||
fn foo(t: bar) {
|
||||
match t {
|
||||
|
|
|
@ -33,7 +33,7 @@ trait fake_ext_ctxt {
|
|||
type fake_session = parse::parse_sess;
|
||||
|
||||
impl fake_ext_ctxt for fake_session {
|
||||
fn cfg() -> ast::CrateConfig { ~[] }
|
||||
fn cfg() -> ast::CrateConfig { Vec::new() }
|
||||
fn parse_sess() -> parse::parse_sess { self }
|
||||
fn call_site() -> span {
|
||||
codemap::span {
|
||||
|
|
|
@ -30,7 +30,7 @@ trait fake_ext_ctxt {
|
|||
type fake_session = parse::parse_sess;
|
||||
|
||||
impl fake_ext_ctxt for fake_session {
|
||||
fn cfg() -> ast::CrateConfig { ~[] }
|
||||
fn cfg() -> ast::CrateConfig { Vec::new() }
|
||||
fn parse_sess() -> parse::parse_sess { self }
|
||||
fn call_site() -> span {
|
||||
codemap::span {
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
// The type of `y` ends up getting inferred to the type of the block.
|
||||
fn broken() {
|
||||
let mut x = 3;
|
||||
let mut _y = ~[&mut x];
|
||||
let mut _y = vec!(&mut x);
|
||||
while x < 10 {
|
||||
let mut z = x;
|
||||
_y.push(&mut z); //~ ERROR `z` does not live long enough
|
||||
|
|
|
@ -12,5 +12,5 @@
|
|||
|
||||
fn main() {
|
||||
let n = 1;
|
||||
let a = ~[0, ..n]; //~ ERROR expected constant integer for repeat count but found variable
|
||||
let a = vec!(0, ..n); //~ ERROR expected constant integer for repeat count but found variable
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
fn main() {
|
||||
trait seq { }
|
||||
|
||||
impl<T> seq<T> for ~[T] { //~ ERROR wrong number of type arguments
|
||||
impl<T> seq<T> for Vec<T> { //~ ERROR wrong number of type arguments
|
||||
/* ... */
|
||||
}
|
||||
impl seq<bool> for u32 {
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
#[no_implicit_prelude];
|
||||
|
||||
fn last<T>(v: ~[&T]) -> std::option::Option<T> {
|
||||
fn last<T>(v: Vec<&T> ) -> std::option::Option<T> {
|
||||
fail!();
|
||||
}
|
||||
|
||||
|
|
|
@ -14,10 +14,10 @@
|
|||
|
||||
// ~ to avoid infinite size.
|
||||
struct Uninstantiable { //~ ERROR cannot be instantiated without an instance of itself
|
||||
p: ~[Uninstantiable, .. 1]
|
||||
p: vec!(Uninstantiable, .. 1)
|
||||
}
|
||||
|
||||
struct Instantiable { p: ~[Instantiable, .. 0] }
|
||||
struct Instantiable { p: vec!(Instantiable, .. 0) }
|
||||
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -25,14 +25,14 @@ impl Drop for r {
|
|||
}
|
||||
}
|
||||
|
||||
fn f<T>(_i: ~[T], _j: ~[T]) {
|
||||
fn f<T>(_i: Vec<T> , _j: Vec<T> ) {
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let i1 = @Cell::new(0);
|
||||
let i2 = @Cell::new(1);
|
||||
let r1 = ~[~r { i: i1 }];
|
||||
let r2 = ~[~r { i: i2 }];
|
||||
let r1 = vec!(~r { i: i1 });
|
||||
let r2 = vec!(~r { i: i2 });
|
||||
f(r1.clone(), r2.clone());
|
||||
//~^ ERROR failed to find an implementation of
|
||||
println!("{:?}", (r2, i1.get()));
|
||||
|
|
|
@ -23,8 +23,7 @@ impl fmt::Show for Number {
|
|||
}
|
||||
|
||||
struct List {
|
||||
list: ~[~ToStr]
|
||||
}
|
||||
list: Vec<~ToStr> }
|
||||
|
||||
impl List {
|
||||
fn push(&mut self, n: ~ToStr) {
|
||||
|
@ -34,7 +33,7 @@ impl List {
|
|||
|
||||
fn main() {
|
||||
let n = ~Number { n: 42 };
|
||||
let mut l = ~List { list: ~[] };
|
||||
let mut l = ~List { list: Vec::new() };
|
||||
l.push(n);
|
||||
let x = n.to_str();
|
||||
//~^ ERROR: use of moved value: `n`
|
||||
|
|
|
@ -1,19 +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.
|
||||
|
||||
// error-pattern:attempted access of field `some_field_name` on type `~[int]`
|
||||
// issue #367
|
||||
|
||||
fn f() {
|
||||
let v = ~[1i];
|
||||
println!("{}", v.some_field_name); //type error
|
||||
}
|
||||
|
||||
fn main() { }
|
|
@ -9,7 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
fn main() {
|
||||
let mut xs = ~[1, 2, 3, 4];
|
||||
let mut xs = vec!(1, 2, 3, 4);
|
||||
|
||||
for x in xs.mut_iter() {
|
||||
xs.push(1) //~ ERROR cannot borrow `xs`
|
||||
|
|
|
@ -22,8 +22,8 @@ impl Drop for r {
|
|||
|
||||
fn main() {
|
||||
// This can't make sense as it would copy the classes
|
||||
let i = ~[r(0)];
|
||||
let j = ~[r(1)];
|
||||
let i = vec!(r(0));
|
||||
let j = vec!(r(1));
|
||||
let k = i + j;
|
||||
println!("{}", j);
|
||||
}
|
||||
|
|
|
@ -9,5 +9,5 @@
|
|||
// except according to those terms.
|
||||
|
||||
fn main() {
|
||||
let _foo = ~[]; //~ ERROR unconstrained type
|
||||
let _foo = Vec::new(); //~ ERROR unconstrained type
|
||||
}
|
||||
|
|
|
@ -9,6 +9,6 @@
|
|||
// except according to those terms.
|
||||
|
||||
fn main() {
|
||||
let v: ~[int] = ~[1, 2, 3];
|
||||
let v: Vec<int> = vec!(1, 2, 3);
|
||||
v[1] = 4; //~ ERROR cannot assign
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
fn main() {
|
||||
|
||||
let unique: ~[i64] = ~[10, 11, 12, 13];
|
||||
let unique: Vec<i64> = vec!(10, 11, 12, 13);
|
||||
|
||||
zzz();
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
fn main() {
|
||||
let args : ~[~str] = ::std::os::args();
|
||||
let args : Vec<~str> = ::std::os::args();
|
||||
::std::io::println(args[0]);
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
fn main() {
|
||||
|
||||
let unique: ~[@i64] = ~[@10, @11, @12, @13];
|
||||
let unique: Vec<@i64> = vec!(@10, @11, @12, @13);
|
||||
|
||||
zzz();
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue