Update the rest of the compiler with ~[T] changes
This commit is contained in:
parent
7d3b0bf391
commit
675b82657e
@ -33,7 +33,6 @@ use std::os;
|
|||||||
use std::str;
|
use std::str;
|
||||||
use std::strbuf::StrBuf;
|
use std::strbuf::StrBuf;
|
||||||
use std::task;
|
use std::task;
|
||||||
use std::slice;
|
|
||||||
use test::MetricMap;
|
use test::MetricMap;
|
||||||
|
|
||||||
pub fn run(config: config, testfile: ~str) {
|
pub fn run(config: config, testfile: ~str) {
|
||||||
@ -509,7 +508,7 @@ fn check_expected_errors(expected_errors: Vec<errors::ExpectedError> ,
|
|||||||
proc_res: &ProcRes) {
|
proc_res: &ProcRes) {
|
||||||
|
|
||||||
// true if we found the error in question
|
// true if we found the error in question
|
||||||
let mut found_flags = slice::from_elem(
|
let mut found_flags = Vec::from_elem(
|
||||||
expected_errors.len(), false);
|
expected_errors.len(), false);
|
||||||
|
|
||||||
if proc_res.status.success() {
|
if proc_res.status.success() {
|
||||||
@ -554,13 +553,13 @@ fn check_expected_errors(expected_errors: Vec<errors::ExpectedError> ,
|
|||||||
for line in proc_res.stderr.lines() {
|
for line in proc_res.stderr.lines() {
|
||||||
let mut was_expected = false;
|
let mut was_expected = false;
|
||||||
for (i, ee) in expected_errors.iter().enumerate() {
|
for (i, ee) in expected_errors.iter().enumerate() {
|
||||||
if !found_flags[i] {
|
if !*found_flags.get(i) {
|
||||||
debug!("prefix={} ee.kind={} ee.msg={} line={}",
|
debug!("prefix={} ee.kind={} ee.msg={} line={}",
|
||||||
*prefixes.get(i), ee.kind, ee.msg, line);
|
*prefixes.get(i), ee.kind, ee.msg, line);
|
||||||
if prefix_matches(line, *prefixes.get(i)) &&
|
if prefix_matches(line, *prefixes.get(i)) &&
|
||||||
line.contains(ee.kind) &&
|
line.contains(ee.kind) &&
|
||||||
line.contains(ee.msg) {
|
line.contains(ee.msg) {
|
||||||
found_flags[i] = true;
|
*found_flags.get_mut(i) = true;
|
||||||
was_expected = true;
|
was_expected = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -255,10 +255,9 @@ might look like the example below.
|
|||||||
|
|
||||||
~~~
|
~~~
|
||||||
# use std::task::spawn;
|
# use std::task::spawn;
|
||||||
# use std::slice;
|
|
||||||
|
|
||||||
// Create a vector of ports, one for each child task
|
// Create a vector of ports, one for each child task
|
||||||
let rxs = slice::from_fn(3, |init_val| {
|
let rxs = Vec::from_fn(3, |init_val| {
|
||||||
let (tx, rx) = channel();
|
let (tx, rx) = channel();
|
||||||
spawn(proc() {
|
spawn(proc() {
|
||||||
tx.send(some_expensive_computation(init_val));
|
tx.send(some_expensive_computation(init_val));
|
||||||
@ -304,7 +303,6 @@ be distributed on the available cores.
|
|||||||
|
|
||||||
~~~
|
~~~
|
||||||
# extern crate sync;
|
# extern crate sync;
|
||||||
# use std::slice;
|
|
||||||
fn partial_sum(start: uint) -> f64 {
|
fn partial_sum(start: uint) -> f64 {
|
||||||
let mut local_sum = 0f64;
|
let mut local_sum = 0f64;
|
||||||
for num in range(start*100000, (start+1)*100000) {
|
for num in range(start*100000, (start+1)*100000) {
|
||||||
@ -314,7 +312,7 @@ fn partial_sum(start: uint) -> f64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut futures = slice::from_fn(1000, |ind| sync::Future::spawn( proc() { partial_sum(ind) }));
|
let mut futures = Vec::from_fn(1000, |ind| sync::Future::spawn( proc() { partial_sum(ind) }));
|
||||||
|
|
||||||
let mut final_res = 0f64;
|
let mut final_res = 0f64;
|
||||||
for ft in futures.mut_iter() {
|
for ft in futures.mut_iter() {
|
||||||
@ -342,15 +340,14 @@ a single large vector of floats. Each task needs the full vector to perform its
|
|||||||
extern crate rand;
|
extern crate rand;
|
||||||
extern crate sync;
|
extern crate sync;
|
||||||
|
|
||||||
use std::slice;
|
|
||||||
use sync::Arc;
|
use sync::Arc;
|
||||||
|
|
||||||
fn pnorm(nums: &~[f64], p: uint) -> f64 {
|
fn pnorm(nums: &[f64], p: uint) -> f64 {
|
||||||
nums.iter().fold(0.0, |a,b| a+(*b).powf(&(p as f64)) ).powf(&(1.0 / (p as f64)))
|
nums.iter().fold(0.0, |a,b| a+(*b).powf(&(p as f64)) ).powf(&(1.0 / (p as f64)))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let numbers = slice::from_fn(1000000, |_| rand::random::<f64>());
|
let numbers = Vec::from_fn(1000000, |_| rand::random::<f64>());
|
||||||
let numbers_arc = Arc::new(numbers);
|
let numbers_arc = Arc::new(numbers);
|
||||||
|
|
||||||
for num in range(1u, 10) {
|
for num in range(1u, 10) {
|
||||||
@ -358,9 +355,9 @@ fn main() {
|
|||||||
tx.send(numbers_arc.clone());
|
tx.send(numbers_arc.clone());
|
||||||
|
|
||||||
spawn(proc() {
|
spawn(proc() {
|
||||||
let local_arc : Arc<~[f64]> = rx.recv();
|
let local_arc : Arc<Vec<f64>> = rx.recv();
|
||||||
let task_numbers = &*local_arc;
|
let task_numbers = &*local_arc;
|
||||||
println!("{}-norm = {}", num, pnorm(task_numbers, num));
|
println!("{}-norm = {}", num, pnorm(task_numbers.as_slice(), num));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -374,9 +371,8 @@ created by the line
|
|||||||
# extern crate sync;
|
# extern crate sync;
|
||||||
# extern crate rand;
|
# extern crate rand;
|
||||||
# use sync::Arc;
|
# use sync::Arc;
|
||||||
# use std::slice;
|
|
||||||
# fn main() {
|
# fn main() {
|
||||||
# let numbers = slice::from_fn(1000000, |_| rand::random::<f64>());
|
# let numbers = Vec::from_fn(1000000, |_| rand::random::<f64>());
|
||||||
let numbers_arc=Arc::new(numbers);
|
let numbers_arc=Arc::new(numbers);
|
||||||
# }
|
# }
|
||||||
~~~
|
~~~
|
||||||
@ -387,9 +383,8 @@ and a clone of it is sent to each task
|
|||||||
# extern crate sync;
|
# extern crate sync;
|
||||||
# extern crate rand;
|
# extern crate rand;
|
||||||
# use sync::Arc;
|
# use sync::Arc;
|
||||||
# use std::slice;
|
|
||||||
# fn main() {
|
# fn main() {
|
||||||
# let numbers=slice::from_fn(1000000, |_| rand::random::<f64>());
|
# let numbers=Vec::from_fn(1000000, |_| rand::random::<f64>());
|
||||||
# let numbers_arc = Arc::new(numbers);
|
# let numbers_arc = Arc::new(numbers);
|
||||||
# let (tx, rx) = channel();
|
# let (tx, rx) = channel();
|
||||||
tx.send(numbers_arc.clone());
|
tx.send(numbers_arc.clone());
|
||||||
@ -404,13 +399,12 @@ Each task recovers the underlying data by
|
|||||||
# extern crate sync;
|
# extern crate sync;
|
||||||
# extern crate rand;
|
# extern crate rand;
|
||||||
# use sync::Arc;
|
# use sync::Arc;
|
||||||
# use std::slice;
|
|
||||||
# fn main() {
|
# fn main() {
|
||||||
# let numbers=slice::from_fn(1000000, |_| rand::random::<f64>());
|
# let numbers=Vec::from_fn(1000000, |_| rand::random::<f64>());
|
||||||
# let numbers_arc=Arc::new(numbers);
|
# let numbers_arc=Arc::new(numbers);
|
||||||
# let (tx, rx) = channel();
|
# let (tx, rx) = channel();
|
||||||
# tx.send(numbers_arc.clone());
|
# tx.send(numbers_arc.clone());
|
||||||
# let local_arc : Arc<~[f64]> = rx.recv();
|
# let local_arc : Arc<Vec<f64>> = rx.recv();
|
||||||
let task_numbers = &*local_arc;
|
let task_numbers = &*local_arc;
|
||||||
# }
|
# }
|
||||||
~~~
|
~~~
|
||||||
|
@ -1582,12 +1582,12 @@ the elements are mutable if the vector is mutable.
|
|||||||
use std::strbuf::StrBuf;
|
use std::strbuf::StrBuf;
|
||||||
|
|
||||||
// A dynamically sized vector (unique vector)
|
// A dynamically sized vector (unique vector)
|
||||||
let mut numbers = ~[1, 2, 3];
|
let mut numbers = vec![1, 2, 3];
|
||||||
numbers.push(4);
|
numbers.push(4);
|
||||||
numbers.push(5);
|
numbers.push(5);
|
||||||
|
|
||||||
// The type of a unique vector is written as `~[int]`
|
// The type of a unique vector is written as `~[int]`
|
||||||
let more_numbers: ~[int] = numbers;
|
let more_numbers: ~[int] = numbers.move_iter().collect();
|
||||||
|
|
||||||
// The original `numbers` value can no longer be used, due to move semantics.
|
// The original `numbers` value can no longer be used, due to move semantics.
|
||||||
|
|
||||||
@ -1955,8 +1955,8 @@ vector consisting of the result of applying `function` to each element
|
|||||||
of `vector`:
|
of `vector`:
|
||||||
|
|
||||||
~~~~
|
~~~~
|
||||||
fn map<T, U>(vector: &[T], function: |v: &T| -> U) -> ~[U] {
|
fn map<T, U>(vector: &[T], function: |v: &T| -> U) -> Vec<U> {
|
||||||
let mut accumulator = ~[];
|
let mut accumulator = Vec::new();
|
||||||
for element in vector.iter() {
|
for element in vector.iter() {
|
||||||
accumulator.push(function(element));
|
accumulator.push(function(element));
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ impl GetAddrInfoRequest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Collect all the results we found
|
// Collect all the results we found
|
||||||
let mut addrs = ~[];
|
let mut addrs = Vec::new();
|
||||||
let mut rp = res;
|
let mut rp = res;
|
||||||
while rp.is_not_null() {
|
while rp.is_not_null() {
|
||||||
unsafe {
|
unsafe {
|
||||||
@ -80,7 +80,7 @@ impl GetAddrInfoRequest {
|
|||||||
|
|
||||||
unsafe { freeaddrinfo(res); }
|
unsafe { freeaddrinfo(res); }
|
||||||
|
|
||||||
Ok(addrs)
|
Ok(addrs.move_iter().collect())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,6 @@ use libc::{c_int, c_void};
|
|||||||
use libc;
|
use libc;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::rt::rtio;
|
use std::rt::rtio;
|
||||||
use std::slice;
|
|
||||||
|
|
||||||
use io::{IoResult, retry, keep_going};
|
use io::{IoResult, retry, keep_going};
|
||||||
|
|
||||||
@ -416,7 +415,7 @@ pub fn readlink(p: &CString) -> IoResult<Path> {
|
|||||||
if len == -1 {
|
if len == -1 {
|
||||||
len = 1024; // FIXME: read PATH_MAX from C ffi?
|
len = 1024; // FIXME: read PATH_MAX from C ffi?
|
||||||
}
|
}
|
||||||
let mut buf = slice::with_capacity::<u8>(len as uint);
|
let mut buf: Vec<u8> = Vec::with_capacity(len as uint);
|
||||||
match retry(|| unsafe {
|
match retry(|| unsafe {
|
||||||
libc::readlink(p, buf.as_ptr() as *mut libc::c_char,
|
libc::readlink(p, buf.as_ptr() as *mut libc::c_char,
|
||||||
len as libc::size_t) as libc::c_int
|
len as libc::size_t) as libc::c_int
|
||||||
|
@ -74,7 +74,7 @@ impl Process {
|
|||||||
return Err(super::unimpl());
|
return Err(super::unimpl());
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_io(io: p::StdioContainer, ret: &mut ~[Option<file::FileDesc>])
|
fn get_io(io: p::StdioContainer, ret: &mut Vec<Option<file::FileDesc>>)
|
||||||
-> (Option<os::Pipe>, c_int)
|
-> (Option<os::Pipe>, c_int)
|
||||||
{
|
{
|
||||||
match io {
|
match io {
|
||||||
@ -93,7 +93,7 @@ impl Process {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut ret_io = ~[];
|
let mut ret_io = Vec::new();
|
||||||
let (in_pipe, in_fd) = get_io(config.stdin, &mut ret_io);
|
let (in_pipe, in_fd) = get_io(config.stdin, &mut ret_io);
|
||||||
let (out_pipe, out_fd) = get_io(config.stdout, &mut ret_io);
|
let (out_pipe, out_fd) = get_io(config.stdout, &mut ret_io);
|
||||||
let (err_pipe, err_fd) = get_io(config.stderr, &mut ret_io);
|
let (err_pipe, err_fd) = get_io(config.stderr, &mut ret_io);
|
||||||
@ -117,7 +117,7 @@ impl Process {
|
|||||||
exit_code: None,
|
exit_code: None,
|
||||||
exit_signal: None,
|
exit_signal: None,
|
||||||
},
|
},
|
||||||
ret_io))
|
ret_io.move_iter().collect()))
|
||||||
}
|
}
|
||||||
Err(e) => Err(e)
|
Err(e) => Err(e)
|
||||||
}
|
}
|
||||||
@ -641,12 +641,10 @@ fn spawn_process_os(config: p::ProcessConfig,
|
|||||||
|
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
fn with_argv<T>(prog: &str, args: &[~str], cb: proc(**libc::c_char) -> T) -> T {
|
fn with_argv<T>(prog: &str, args: &[~str], cb: proc(**libc::c_char) -> T) -> T {
|
||||||
use std::slice;
|
|
||||||
|
|
||||||
// We can't directly convert `str`s into `*char`s, as someone needs to hold
|
// We can't directly convert `str`s into `*char`s, as someone needs to hold
|
||||||
// a reference to the intermediary byte buffers. So first build an array to
|
// a reference to the intermediary byte buffers. So first build an array to
|
||||||
// hold all the ~[u8] byte strings.
|
// hold all the ~[u8] byte strings.
|
||||||
let mut tmps = slice::with_capacity(args.len() + 1);
|
let mut tmps = Vec::with_capacity(args.len() + 1);
|
||||||
|
|
||||||
tmps.push(prog.to_c_str());
|
tmps.push(prog.to_c_str());
|
||||||
|
|
||||||
@ -667,14 +665,12 @@ fn with_argv<T>(prog: &str, args: &[~str], cb: proc(**libc::c_char) -> T) -> T {
|
|||||||
|
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
fn with_envp<T>(env: Option<~[(~str, ~str)]>, cb: proc(*c_void) -> T) -> T {
|
fn with_envp<T>(env: Option<~[(~str, ~str)]>, cb: proc(*c_void) -> T) -> T {
|
||||||
use std::slice;
|
|
||||||
|
|
||||||
// On posixy systems we can pass a char** for envp, which is a
|
// On posixy systems we can pass a char** for envp, which is a
|
||||||
// null-terminated array of "k=v\n" strings. Like `with_argv`, we have to
|
// null-terminated array of "k=v\n" strings. Like `with_argv`, we have to
|
||||||
// have a temporary buffer to hold the intermediary `~[u8]` byte strings.
|
// have a temporary buffer to hold the intermediary `~[u8]` byte strings.
|
||||||
match env {
|
match env {
|
||||||
Some(env) => {
|
Some(env) => {
|
||||||
let mut tmps = slice::with_capacity(env.len());
|
let mut tmps = Vec::with_capacity(env.len());
|
||||||
|
|
||||||
for pair in env.iter() {
|
for pair in env.iter() {
|
||||||
let kv = format!("{}={}", *pair.ref0(), *pair.ref1());
|
let kv = format!("{}={}", *pair.ref0(), *pair.ref1());
|
||||||
@ -700,7 +696,7 @@ fn with_envp<T>(env: Option<~[(~str, ~str)]>, cb: |*mut c_void| -> T) -> T {
|
|||||||
// \0 to terminate.
|
// \0 to terminate.
|
||||||
match env {
|
match env {
|
||||||
Some(env) => {
|
Some(env) => {
|
||||||
let mut blk = ~[];
|
let mut blk = Vec::new();
|
||||||
|
|
||||||
for pair in env.iter() {
|
for pair in env.iter() {
|
||||||
let kv = format!("{}={}", *pair.ref0(), *pair.ref1());
|
let kv = format!("{}={}", *pair.ref0(), *pair.ref1());
|
||||||
|
@ -156,8 +156,6 @@ pub fn minimize_rpaths(rpaths: &[~str]) -> Vec<~str> {
|
|||||||
|
|
||||||
#[cfg(unix, test)]
|
#[cfg(unix, test)]
|
||||||
mod test {
|
mod test {
|
||||||
use std::os;
|
|
||||||
|
|
||||||
use back::rpath::get_install_prefix_rpath;
|
use back::rpath::get_install_prefix_rpath;
|
||||||
use back::rpath::{minimize_rpaths, rpaths_to_flags, get_rpath_relative_to_output};
|
use back::rpath::{minimize_rpaths, rpaths_to_flags, get_rpath_relative_to_output};
|
||||||
use syntax::abi;
|
use syntax::abi;
|
||||||
|
@ -223,13 +223,13 @@ pub fn describe_codegen_flags() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn run_compiler(args: &[~str]) {
|
pub fn run_compiler(args: &[~str]) {
|
||||||
let mut args = args.to_owned();
|
let mut args = Vec::from_slice(args);
|
||||||
let binary = args.shift().unwrap();
|
let binary = args.shift().unwrap();
|
||||||
|
|
||||||
if args.is_empty() { usage(binary); return; }
|
if args.is_empty() { usage(binary); return; }
|
||||||
|
|
||||||
let matches =
|
let matches =
|
||||||
&match getopts::getopts(args, d::optgroups().as_slice()) {
|
&match getopts::getopts(args.as_slice(), d::optgroups().as_slice()) {
|
||||||
Ok(m) => m,
|
Ok(m) => m,
|
||||||
Err(f) => {
|
Err(f) => {
|
||||||
d::early_error(f.to_err_msg());
|
d::early_error(f.to_err_msg());
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
|
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::slice;
|
|
||||||
use std::strbuf::StrBuf;
|
use std::strbuf::StrBuf;
|
||||||
use std::uint;
|
use std::uint;
|
||||||
use syntax::ast;
|
use syntax::ast;
|
||||||
@ -308,13 +307,13 @@ impl<'a, O:DataFlowOperator+Clone+'static> DataFlowContext<'a, O> {
|
|||||||
changed: true
|
changed: true
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut temp = slice::from_elem(self.words_per_id, 0u);
|
let mut temp = Vec::from_elem(self.words_per_id, 0u);
|
||||||
let mut loop_scopes = Vec::new();
|
let mut loop_scopes = Vec::new();
|
||||||
|
|
||||||
while propcx.changed {
|
while propcx.changed {
|
||||||
propcx.changed = false;
|
propcx.changed = false;
|
||||||
propcx.reset(temp);
|
propcx.reset(temp.as_mut_slice());
|
||||||
propcx.walk_block(blk, temp, &mut loop_scopes);
|
propcx.walk_block(blk, temp.as_mut_slice(), &mut loop_scopes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,8 +16,6 @@
|
|||||||
* closure.
|
* closure.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use std::slice;
|
|
||||||
|
|
||||||
use back::abi;
|
use back::abi;
|
||||||
use driver::session;
|
use driver::session;
|
||||||
use lib::llvm::{ValueRef, NoAliasAttribute, StructRetAttribute, NoCaptureAttribute};
|
use lib::llvm::{ValueRef, NoAliasAttribute, StructRetAttribute, NoCaptureAttribute};
|
||||||
@ -221,11 +219,12 @@ fn resolve_default_method_vtables(bcx: &Block,
|
|||||||
Some(vtables) => {
|
Some(vtables) => {
|
||||||
let num_impl_type_parameters =
|
let num_impl_type_parameters =
|
||||||
vtables.len() - num_method_vtables;
|
vtables.len() - num_method_vtables;
|
||||||
vtables.tailn(num_impl_type_parameters).to_owned()
|
Vec::from_slice(vtables.tailn(num_impl_type_parameters))
|
||||||
},
|
},
|
||||||
None => slice::from_elem(num_method_vtables, @Vec::new())
|
None => Vec::from_elem(num_method_vtables, @Vec::new())
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let method_vtables = method_vtables.as_slice();
|
||||||
let param_vtables = @((*trait_vtables_fixed).clone().append(method_vtables));
|
let param_vtables = @((*trait_vtables_fixed).clone().append(method_vtables));
|
||||||
|
|
||||||
let self_vtables = resolve_param_vtables_under_param_substs(
|
let self_vtables = resolve_param_vtables_under_param_substs(
|
||||||
|
@ -593,11 +593,11 @@ fn const_expr_unadjusted(cx: &CrateContext, e: &ast::Expr,
|
|||||||
const_eval::const_uint(i) => i as uint,
|
const_eval::const_uint(i) => i as uint,
|
||||||
_ => cx.sess().span_bug(count.span, "count must be integral const expression.")
|
_ => cx.sess().span_bug(count.span, "count must be integral const expression.")
|
||||||
};
|
};
|
||||||
let vs = slice::from_elem(n, const_expr(cx, elem, is_local).val0());
|
let vs = Vec::from_elem(n, const_expr(cx, elem, is_local).val0());
|
||||||
let v = if vs.iter().any(|vi| val_ty(*vi) != llunitty) {
|
let v = if vs.iter().any(|vi| val_ty(*vi) != llunitty) {
|
||||||
C_struct(cx, vs, false)
|
C_struct(cx, vs.as_slice(), false)
|
||||||
} else {
|
} else {
|
||||||
C_array(llunitty, vs)
|
C_array(llunitty, vs.as_slice())
|
||||||
};
|
};
|
||||||
(v, true)
|
(v, true)
|
||||||
}
|
}
|
||||||
|
@ -148,7 +148,6 @@ use collections::HashMap;
|
|||||||
use collections::HashSet;
|
use collections::HashSet;
|
||||||
use libc::{c_uint, c_ulonglong, c_longlong};
|
use libc::{c_uint, c_ulonglong, c_longlong};
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use std::slice;
|
|
||||||
use std::strbuf::StrBuf;
|
use std::strbuf::StrBuf;
|
||||||
use std::sync::atomics;
|
use std::sync::atomics;
|
||||||
use syntax::codemap::{Span, Pos};
|
use syntax::codemap::{Span, Pos};
|
||||||
@ -776,7 +775,7 @@ pub fn create_function_debug_context(cx: &CrateContext,
|
|||||||
return create_DIArray(DIB(cx), []);
|
return create_DIArray(DIB(cx), []);
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut signature = slice::with_capacity(fn_decl.inputs.len() + 1);
|
let mut signature = Vec::with_capacity(fn_decl.inputs.len() + 1);
|
||||||
|
|
||||||
// Return type -- llvm::DIBuilder wants this at index 0
|
// Return type -- llvm::DIBuilder wants this at index 0
|
||||||
match fn_decl.output.node {
|
match fn_decl.output.node {
|
||||||
@ -818,7 +817,7 @@ pub fn create_function_debug_context(cx: &CrateContext,
|
|||||||
signature.push(type_metadata(cx, arg_type, codemap::DUMMY_SP));
|
signature.push(type_metadata(cx, arg_type, codemap::DUMMY_SP));
|
||||||
}
|
}
|
||||||
|
|
||||||
return create_DIArray(DIB(cx), signature);
|
return create_DIArray(DIB(cx), signature.as_slice());
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_template_parameters(cx: &CrateContext,
|
fn get_template_parameters(cx: &CrateContext,
|
||||||
@ -961,7 +960,7 @@ fn compile_unit_metadata(cx: &CrateContext) {
|
|||||||
// prepend "./" if necessary
|
// prepend "./" if necessary
|
||||||
let dotdot = bytes!("..");
|
let dotdot = bytes!("..");
|
||||||
let prefix = &[dotdot[0], ::std::path::SEP_BYTE];
|
let prefix = &[dotdot[0], ::std::path::SEP_BYTE];
|
||||||
let mut path_bytes = p.as_vec().to_owned();
|
let mut path_bytes = Vec::from_slice(p.as_vec());
|
||||||
|
|
||||||
if path_bytes.slice_to(2) != prefix &&
|
if path_bytes.slice_to(2) != prefix &&
|
||||||
path_bytes.slice_to(2) != dotdot {
|
path_bytes.slice_to(2) != dotdot {
|
||||||
@ -969,7 +968,7 @@ fn compile_unit_metadata(cx: &CrateContext) {
|
|||||||
path_bytes.insert(1, prefix[1]);
|
path_bytes.insert(1, prefix[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
path_bytes.to_c_str()
|
path_bytes.as_slice().to_c_str()
|
||||||
}
|
}
|
||||||
_ => fallback_path(cx)
|
_ => fallback_path(cx)
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,6 @@ use util::nodemap::NodeMap;
|
|||||||
use middle::trans::machine::{llsize_of, llsize_of_alloc};
|
use middle::trans::machine::{llsize_of, llsize_of_alloc};
|
||||||
use middle::trans::type_::Type;
|
use middle::trans::type_::Type;
|
||||||
|
|
||||||
use std::slice;
|
|
||||||
use syntax::ast;
|
use syntax::ast;
|
||||||
use syntax::codemap;
|
use syntax::codemap;
|
||||||
use syntax::print::pprust::{expr_to_str};
|
use syntax::print::pprust::{expr_to_str};
|
||||||
@ -969,7 +968,7 @@ fn trans_rec_or_struct<'a>(
|
|||||||
let ty = node_id_type(bcx, id);
|
let ty = node_id_type(bcx, id);
|
||||||
let tcx = bcx.tcx();
|
let tcx = bcx.tcx();
|
||||||
with_field_tys(tcx, ty, Some(id), |discr, field_tys| {
|
with_field_tys(tcx, ty, Some(id), |discr, field_tys| {
|
||||||
let mut need_base = slice::from_elem(field_tys.len(), true);
|
let mut need_base = Vec::from_elem(field_tys.len(), true);
|
||||||
|
|
||||||
let numbered_fields = fields.iter().map(|field| {
|
let numbered_fields = fields.iter().map(|field| {
|
||||||
let opt_pos =
|
let opt_pos =
|
||||||
@ -977,7 +976,7 @@ fn trans_rec_or_struct<'a>(
|
|||||||
field_ty.ident.name == field.ident.node.name);
|
field_ty.ident.name == field.ident.node.name);
|
||||||
match opt_pos {
|
match opt_pos {
|
||||||
Some(i) => {
|
Some(i) => {
|
||||||
need_base[i] = false;
|
*need_base.get_mut(i) = false;
|
||||||
(i, field.expr)
|
(i, field.expr)
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
|
@ -118,7 +118,6 @@ use std::cell::{Cell, RefCell};
|
|||||||
use collections::HashMap;
|
use collections::HashMap;
|
||||||
use std::mem::replace;
|
use std::mem::replace;
|
||||||
use std::result;
|
use std::result;
|
||||||
use std::slice;
|
|
||||||
use std::vec::Vec;
|
use std::vec::Vec;
|
||||||
use syntax::abi;
|
use syntax::abi;
|
||||||
use syntax::ast::{Provided, Required};
|
use syntax::ast::{Provided, Required};
|
||||||
@ -3906,13 +3905,13 @@ pub fn check_bounds_are_used(ccx: &CrateCtxt,
|
|||||||
|
|
||||||
// make a vector of booleans initially false, set to true when used
|
// make a vector of booleans initially false, set to true when used
|
||||||
if tps.len() == 0u { return; }
|
if tps.len() == 0u { return; }
|
||||||
let mut tps_used = slice::from_elem(tps.len(), false);
|
let mut tps_used = Vec::from_elem(tps.len(), false);
|
||||||
|
|
||||||
ty::walk_ty(ty, |t| {
|
ty::walk_ty(ty, |t| {
|
||||||
match ty::get(t).sty {
|
match ty::get(t).sty {
|
||||||
ty::ty_param(param_ty {idx, ..}) => {
|
ty::ty_param(param_ty {idx, ..}) => {
|
||||||
debug!("Found use of ty param \\#{}", idx);
|
debug!("Found use of ty param \\#{}", idx);
|
||||||
tps_used[idx] = true;
|
*tps_used.get_mut(idx) = true;
|
||||||
}
|
}
|
||||||
_ => ()
|
_ => ()
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,6 @@ use util::ppaux::{Repr};
|
|||||||
|
|
||||||
use std::cell::{Cell, RefCell};
|
use std::cell::{Cell, RefCell};
|
||||||
use std::uint;
|
use std::uint;
|
||||||
use std::slice;
|
|
||||||
use collections::{HashMap, HashSet};
|
use collections::{HashMap, HashSet};
|
||||||
use syntax::ast;
|
use syntax::ast;
|
||||||
|
|
||||||
@ -1004,7 +1003,7 @@ impl<'a> RegionVarBindings<'a> {
|
|||||||
// idea is to report errors that derive from independent
|
// idea is to report errors that derive from independent
|
||||||
// regions of the graph, but not those that derive from
|
// regions of the graph, but not those that derive from
|
||||||
// overlapping locations.
|
// overlapping locations.
|
||||||
let mut dup_vec = slice::from_elem(self.num_vars(), uint::MAX);
|
let mut dup_vec = Vec::from_elem(self.num_vars(), uint::MAX);
|
||||||
|
|
||||||
let mut opt_graph = None;
|
let mut opt_graph = None;
|
||||||
|
|
||||||
@ -1052,11 +1051,13 @@ impl<'a> RegionVarBindings<'a> {
|
|||||||
match var_data[idx].classification {
|
match var_data[idx].classification {
|
||||||
Expanding => {
|
Expanding => {
|
||||||
self.collect_error_for_expanding_node(
|
self.collect_error_for_expanding_node(
|
||||||
graph, var_data, dup_vec, node_vid, errors);
|
graph, var_data, dup_vec.as_mut_slice(),
|
||||||
|
node_vid, errors);
|
||||||
}
|
}
|
||||||
Contracting => {
|
Contracting => {
|
||||||
self.collect_error_for_contracting_node(
|
self.collect_error_for_contracting_node(
|
||||||
graph, var_data, dup_vec, node_vid, errors);
|
graph, var_data, dup_vec.as_mut_slice(),
|
||||||
|
node_vid, errors);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -525,7 +525,6 @@ mod tests {
|
|||||||
|
|
||||||
use super::{Digest, Sha256, FixedBuffer};
|
use super::{Digest, Sha256, FixedBuffer};
|
||||||
use std::num::Bounded;
|
use std::num::Bounded;
|
||||||
use std::slice;
|
|
||||||
use self::rand::isaac::IsaacRng;
|
use self::rand::isaac::IsaacRng;
|
||||||
use self::rand::Rng;
|
use self::rand::Rng;
|
||||||
use serialize::hex::FromHex;
|
use serialize::hex::FromHex;
|
||||||
@ -600,7 +599,7 @@ mod tests {
|
|||||||
/// correct.
|
/// correct.
|
||||||
fn test_digest_1million_random<D: Digest>(digest: &mut D, blocksize: uint, expected: &str) {
|
fn test_digest_1million_random<D: Digest>(digest: &mut D, blocksize: uint, expected: &str) {
|
||||||
let total_size = 1000000;
|
let total_size = 1000000;
|
||||||
let buffer = slice::from_elem(blocksize * 2, 'a' as u8);
|
let buffer = Vec::from_elem(blocksize * 2, 'a' as u8);
|
||||||
let mut rng = IsaacRng::new_unseeded();
|
let mut rng = IsaacRng::new_unseeded();
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
|
|
||||||
|
@ -38,7 +38,6 @@ use std::fmt;
|
|||||||
use std::io::{fs, File, BufferedWriter, MemWriter, BufferedReader};
|
use std::io::{fs, File, BufferedWriter, MemWriter, BufferedReader};
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::local_data;
|
use std::local_data;
|
||||||
use std::slice;
|
|
||||||
use std::str;
|
use std::str;
|
||||||
use std::strbuf::StrBuf;
|
use std::strbuf::StrBuf;
|
||||||
|
|
||||||
@ -1047,7 +1046,7 @@ fn item_module(w: &mut Writer, cx: &Context,
|
|||||||
item: &clean::Item, items: &[clean::Item]) -> fmt::Result {
|
item: &clean::Item, items: &[clean::Item]) -> fmt::Result {
|
||||||
try!(document(w, item));
|
try!(document(w, item));
|
||||||
debug!("{:?}", items);
|
debug!("{:?}", items);
|
||||||
let mut indices = slice::from_fn(items.len(), |i| i);
|
let mut indices = Vec::from_fn(items.len(), |i| i);
|
||||||
|
|
||||||
fn cmp(i1: &clean::Item, i2: &clean::Item, idx1: uint, idx2: uint) -> Ordering {
|
fn cmp(i1: &clean::Item, i2: &clean::Item, idx1: uint, idx2: uint) -> Ordering {
|
||||||
if shortty(i1) == shortty(i2) {
|
if shortty(i1) == shortty(i2) {
|
||||||
|
@ -169,8 +169,8 @@ fn runtest(test: &str, cratename: &str, libs: HashSet<Path>, should_fail: bool,
|
|||||||
|
|
||||||
fn maketest(s: &str, cratename: &str, loose_feature_gating: bool) -> ~str {
|
fn maketest(s: &str, cratename: &str, loose_feature_gating: bool) -> ~str {
|
||||||
let mut prog = StrBuf::from_str(r"
|
let mut prog = StrBuf::from_str(r"
|
||||||
#![deny(warnings)];
|
#![deny(warnings)]
|
||||||
#![allow(unused_variable, dead_assignment, unused_mut, attribute_usage, dead_code)];
|
#![allow(unused_variable, dead_assignment, unused_mut, attribute_usage, dead_code)]
|
||||||
");
|
");
|
||||||
|
|
||||||
if loose_feature_gating {
|
if loose_feature_gating {
|
||||||
|
@ -138,7 +138,7 @@ pub fn accum_addrinfo(addr: &Addrinfo) -> ~[ai::Info] {
|
|||||||
unsafe {
|
unsafe {
|
||||||
let mut addr = addr.handle;
|
let mut addr = addr.handle;
|
||||||
|
|
||||||
let mut addrs = ~[];
|
let mut addrs = Vec::new();
|
||||||
loop {
|
loop {
|
||||||
let rustaddr = net::sockaddr_to_addr(cast::transmute((*addr).ai_addr),
|
let rustaddr = net::sockaddr_to_addr(cast::transmute((*addr).ai_addr),
|
||||||
(*addr).ai_addrlen as uint);
|
(*addr).ai_addrlen as uint);
|
||||||
@ -180,6 +180,6 @@ pub fn accum_addrinfo(addr: &Addrinfo) -> ~[ai::Info] {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return addrs;
|
return addrs.move_iter().collect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -469,7 +469,6 @@ mod test {
|
|||||||
use libc::{O_CREAT, O_RDWR, O_RDONLY, S_IWUSR, S_IRUSR};
|
use libc::{O_CREAT, O_RDWR, O_RDONLY, S_IWUSR, S_IRUSR};
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::str;
|
use std::str;
|
||||||
use std::slice;
|
|
||||||
use super::FsRequest;
|
use super::FsRequest;
|
||||||
use super::super::Loop;
|
use super::super::Loop;
|
||||||
use super::super::local_loop;
|
use super::super::local_loop;
|
||||||
@ -505,8 +504,8 @@ mod test {
|
|||||||
let fd = result.fd;
|
let fd = result.fd;
|
||||||
|
|
||||||
// read
|
// read
|
||||||
let mut read_mem = slice::from_elem(1000, 0u8);
|
let mut read_mem = Vec::from_elem(1000, 0u8);
|
||||||
let result = FsRequest::read(l(), fd, read_mem, 0);
|
let result = FsRequest::read(l(), fd, read_mem.as_mut_slice(), 0);
|
||||||
assert!(result.is_ok());
|
assert!(result.is_ok());
|
||||||
|
|
||||||
let nread = result.unwrap();
|
let nread = result.unwrap();
|
||||||
|
@ -15,7 +15,6 @@ use libc;
|
|||||||
use std::ptr;
|
use std::ptr;
|
||||||
use std::rt::rtio::RtioProcess;
|
use std::rt::rtio::RtioProcess;
|
||||||
use std::rt::task::BlockedTask;
|
use std::rt::task::BlockedTask;
|
||||||
use std::slice;
|
|
||||||
|
|
||||||
use homing::{HomingIO, HomeHandle};
|
use homing::{HomingIO, HomeHandle};
|
||||||
use pipe::PipeWatcher;
|
use pipe::PipeWatcher;
|
||||||
@ -44,12 +43,12 @@ impl Process {
|
|||||||
-> Result<(~Process, ~[Option<PipeWatcher>]), UvError>
|
-> Result<(~Process, ~[Option<PipeWatcher>]), UvError>
|
||||||
{
|
{
|
||||||
let cwd = config.cwd.map(|s| s.to_c_str());
|
let cwd = config.cwd.map(|s| s.to_c_str());
|
||||||
let mut io = ~[config.stdin, config.stdout, config.stderr];
|
let mut io = vec![config.stdin, config.stdout, config.stderr];
|
||||||
for slot in config.extra_io.iter() {
|
for slot in config.extra_io.iter() {
|
||||||
io.push(*slot);
|
io.push(*slot);
|
||||||
}
|
}
|
||||||
let mut stdio = slice::with_capacity::<uvll::uv_stdio_container_t>(io.len());
|
let mut stdio = Vec::<uvll::uv_stdio_container_t>::with_capacity(io.len());
|
||||||
let mut ret_io = slice::with_capacity(io.len());
|
let mut ret_io = Vec::with_capacity(io.len());
|
||||||
unsafe {
|
unsafe {
|
||||||
stdio.set_len(io.len());
|
stdio.set_len(io.len());
|
||||||
for (slot, other) in stdio.iter().zip(io.iter()) {
|
for (slot, other) in stdio.iter().zip(io.iter()) {
|
||||||
@ -104,7 +103,7 @@ impl Process {
|
|||||||
});
|
});
|
||||||
|
|
||||||
match ret {
|
match ret {
|
||||||
Ok(p) => Ok((p, ret_io)),
|
Ok(p) => Ok((p, ret_io.move_iter().collect())),
|
||||||
Err(e) => Err(e),
|
Err(e) => Err(e),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -167,14 +166,14 @@ unsafe fn set_stdio(dst: *uvll::uv_stdio_container_t,
|
|||||||
fn with_argv<T>(prog: &str, args: &[~str], f: |**libc::c_char| -> T) -> T {
|
fn with_argv<T>(prog: &str, args: &[~str], f: |**libc::c_char| -> T) -> T {
|
||||||
// First, allocation space to put all the C-strings (we need to have
|
// First, allocation space to put all the C-strings (we need to have
|
||||||
// ownership of them somewhere
|
// ownership of them somewhere
|
||||||
let mut c_strs = slice::with_capacity(args.len() + 1);
|
let mut c_strs = Vec::with_capacity(args.len() + 1);
|
||||||
c_strs.push(prog.to_c_str());
|
c_strs.push(prog.to_c_str());
|
||||||
for arg in args.iter() {
|
for arg in args.iter() {
|
||||||
c_strs.push(arg.to_c_str());
|
c_strs.push(arg.to_c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Next, create the char** array
|
// Next, create the char** array
|
||||||
let mut c_args = slice::with_capacity(c_strs.len() + 1);
|
let mut c_args = Vec::with_capacity(c_strs.len() + 1);
|
||||||
for s in c_strs.iter() {
|
for s in c_strs.iter() {
|
||||||
c_args.push(s.with_ref(|p| p));
|
c_args.push(s.with_ref(|p| p));
|
||||||
}
|
}
|
||||||
@ -189,11 +188,11 @@ fn with_env<T>(env: Option<&[(~str, ~str)]>, f: |**libc::c_char| -> T) -> T {
|
|||||||
None => { return f(ptr::null()); }
|
None => { return f(ptr::null()); }
|
||||||
};
|
};
|
||||||
// As with argv, create some temporary storage and then the actual array
|
// As with argv, create some temporary storage and then the actual array
|
||||||
let mut envp = slice::with_capacity(env.len());
|
let mut envp = Vec::with_capacity(env.len());
|
||||||
for &(ref key, ref value) in env.iter() {
|
for &(ref key, ref value) in env.iter() {
|
||||||
envp.push(format!("{}={}", *key, *value).to_c_str());
|
envp.push(format!("{}={}", *key, *value).to_c_str());
|
||||||
}
|
}
|
||||||
let mut c_envp = slice::with_capacity(envp.len() + 1);
|
let mut c_envp = Vec::with_capacity(envp.len() + 1);
|
||||||
for s in envp.iter() {
|
for s in envp.iter() {
|
||||||
c_envp.push(s.with_ref(|p| p));
|
c_envp.push(s.with_ref(|p| p));
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ impl<'a> ToBase64 for &'a [u8] {
|
|||||||
UrlSafe => URLSAFE_CHARS
|
UrlSafe => URLSAFE_CHARS
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut v: ~[u8] = ~[];
|
let mut v = Vec::new();
|
||||||
let mut i = 0;
|
let mut i = 0;
|
||||||
let mut cur_length = 0;
|
let mut cur_length = 0;
|
||||||
let len = self.len();
|
let len = self.len();
|
||||||
@ -146,7 +146,7 @@ impl<'a> ToBase64 for &'a [u8] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
str::raw::from_utf8_owned(v)
|
str::raw::from_utf8_owned(v.move_iter().collect())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -208,7 +208,7 @@ impl<'a> FromBase64 for &'a str {
|
|||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
fn from_base64(&self) -> Result<~[u8], FromBase64Error> {
|
fn from_base64(&self) -> Result<~[u8], FromBase64Error> {
|
||||||
let mut r = ~[];
|
let mut r = Vec::new();
|
||||||
let mut buf: u32 = 0;
|
let mut buf: u32 = 0;
|
||||||
let mut modulus = 0;
|
let mut modulus = 0;
|
||||||
|
|
||||||
@ -256,7 +256,7 @@ impl<'a> FromBase64 for &'a str {
|
|||||||
_ => return Err(InvalidBase64Length),
|
_ => return Err(InvalidBase64Length),
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(r)
|
Ok(r.move_iter().collect())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -337,12 +337,12 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_base64_random() {
|
fn test_base64_random() {
|
||||||
use self::rand::{task_rng, random, Rng};
|
use self::rand::{task_rng, random, Rng};
|
||||||
use std::slice;
|
|
||||||
|
|
||||||
for _ in range(0, 1000) {
|
for _ in range(0, 1000) {
|
||||||
let times = task_rng().gen_range(1u, 100);
|
let times = task_rng().gen_range(1u, 100);
|
||||||
let v = slice::from_fn(times, |_| random::<u8>());
|
let v = Vec::from_fn(times, |_| random::<u8>());
|
||||||
assert_eq!(v.to_base64(STANDARD).from_base64().unwrap(), v);
|
assert_eq!(v.as_slice().to_base64(STANDARD).from_base64().unwrap(),
|
||||||
|
v.as_slice().to_owned());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1099,8 +1099,7 @@ mod bench {
|
|||||||
|
|
||||||
#[bench]
|
#[bench]
|
||||||
pub fn vuint_at_A_aligned(b: &mut Bencher) {
|
pub fn vuint_at_A_aligned(b: &mut Bencher) {
|
||||||
use std::slice;
|
let data = Vec::from_fn(4*100, |i| {
|
||||||
let data = slice::from_fn(4*100, |i| {
|
|
||||||
match i % 2 {
|
match i % 2 {
|
||||||
0 => 0x80u8,
|
0 => 0x80u8,
|
||||||
_ => i as u8,
|
_ => i as u8,
|
||||||
@ -1110,7 +1109,7 @@ mod bench {
|
|||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
let mut i = 0;
|
let mut i = 0;
|
||||||
while i < data.len() {
|
while i < data.len() {
|
||||||
sum += reader::vuint_at(data, i).unwrap().val;
|
sum += reader::vuint_at(data.as_slice(), i).unwrap().val;
|
||||||
i += 4;
|
i += 4;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -1118,8 +1117,7 @@ mod bench {
|
|||||||
|
|
||||||
#[bench]
|
#[bench]
|
||||||
pub fn vuint_at_A_unaligned(b: &mut Bencher) {
|
pub fn vuint_at_A_unaligned(b: &mut Bencher) {
|
||||||
use std::slice;
|
let data = Vec::from_fn(4*100+1, |i| {
|
||||||
let data = slice::from_fn(4*100+1, |i| {
|
|
||||||
match i % 2 {
|
match i % 2 {
|
||||||
1 => 0x80u8,
|
1 => 0x80u8,
|
||||||
_ => i as u8
|
_ => i as u8
|
||||||
@ -1129,7 +1127,7 @@ mod bench {
|
|||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
let mut i = 1;
|
let mut i = 1;
|
||||||
while i < data.len() {
|
while i < data.len() {
|
||||||
sum += reader::vuint_at(data, i).unwrap().val;
|
sum += reader::vuint_at(data.as_slice(), i).unwrap().val;
|
||||||
i += 4;
|
i += 4;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -1137,8 +1135,7 @@ mod bench {
|
|||||||
|
|
||||||
#[bench]
|
#[bench]
|
||||||
pub fn vuint_at_D_aligned(b: &mut Bencher) {
|
pub fn vuint_at_D_aligned(b: &mut Bencher) {
|
||||||
use std::slice;
|
let data = Vec::from_fn(4*100, |i| {
|
||||||
let data = slice::from_fn(4*100, |i| {
|
|
||||||
match i % 4 {
|
match i % 4 {
|
||||||
0 => 0x10u8,
|
0 => 0x10u8,
|
||||||
3 => i as u8,
|
3 => i as u8,
|
||||||
@ -1149,7 +1146,7 @@ mod bench {
|
|||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
let mut i = 0;
|
let mut i = 0;
|
||||||
while i < data.len() {
|
while i < data.len() {
|
||||||
sum += reader::vuint_at(data, i).unwrap().val;
|
sum += reader::vuint_at(data.as_slice(), i).unwrap().val;
|
||||||
i += 4;
|
i += 4;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -1157,8 +1154,7 @@ mod bench {
|
|||||||
|
|
||||||
#[bench]
|
#[bench]
|
||||||
pub fn vuint_at_D_unaligned(b: &mut Bencher) {
|
pub fn vuint_at_D_unaligned(b: &mut Bencher) {
|
||||||
use std::slice;
|
let data = Vec::from_fn(4*100+1, |i| {
|
||||||
let data = slice::from_fn(4*100+1, |i| {
|
|
||||||
match i % 4 {
|
match i % 4 {
|
||||||
1 => 0x10u8,
|
1 => 0x10u8,
|
||||||
0 => i as u8,
|
0 => i as u8,
|
||||||
@ -1169,7 +1165,7 @@ mod bench {
|
|||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
let mut i = 1;
|
let mut i = 1;
|
||||||
while i < data.len() {
|
while i < data.len() {
|
||||||
sum += reader::vuint_at(data, i).unwrap().val;
|
sum += reader::vuint_at(data.as_slice(), i).unwrap().val;
|
||||||
i += 4;
|
i += 4;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
|
|
||||||
//! Hex binary-to-text encoding
|
//! Hex binary-to-text encoding
|
||||||
use std::str;
|
use std::str;
|
||||||
use std::slice;
|
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
/// A trait for converting a value to hexadecimal encoding
|
/// A trait for converting a value to hexadecimal encoding
|
||||||
@ -39,14 +38,14 @@ impl<'a> ToHex for &'a [u8] {
|
|||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
fn to_hex(&self) -> ~str {
|
fn to_hex(&self) -> ~str {
|
||||||
let mut v = slice::with_capacity(self.len() * 2);
|
let mut v = Vec::with_capacity(self.len() * 2);
|
||||||
for &byte in self.iter() {
|
for &byte in self.iter() {
|
||||||
v.push(CHARS[(byte >> 4) as uint]);
|
v.push(CHARS[(byte >> 4) as uint]);
|
||||||
v.push(CHARS[(byte & 0xf) as uint]);
|
v.push(CHARS[(byte & 0xf) as uint]);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
str::raw::from_utf8_owned(v)
|
str::raw::from_utf8_owned(v.move_iter().collect())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -106,7 +105,7 @@ impl<'a> FromHex for &'a str {
|
|||||||
*/
|
*/
|
||||||
fn from_hex(&self) -> Result<~[u8], FromHexError> {
|
fn from_hex(&self) -> Result<~[u8], FromHexError> {
|
||||||
// This may be an overestimate if there is any whitespace
|
// This may be an overestimate if there is any whitespace
|
||||||
let mut b = slice::with_capacity(self.len() / 2);
|
let mut b = Vec::with_capacity(self.len() / 2);
|
||||||
let mut modulus = 0;
|
let mut modulus = 0;
|
||||||
let mut buf = 0u8;
|
let mut buf = 0u8;
|
||||||
|
|
||||||
@ -132,7 +131,7 @@ impl<'a> FromHex for &'a str {
|
|||||||
}
|
}
|
||||||
|
|
||||||
match modulus {
|
match modulus {
|
||||||
0 => Ok(b),
|
0 => Ok(b.move_iter().collect()),
|
||||||
_ => Err(InvalidHexLength),
|
_ => Err(InvalidHexLength),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1230,11 +1230,11 @@ impl<T : Iterator<char>> Parser<T> {
|
|||||||
self.bump();
|
self.bump();
|
||||||
self.parse_whitespace();
|
self.parse_whitespace();
|
||||||
|
|
||||||
let mut values = ~[];
|
let mut values = Vec::new();
|
||||||
|
|
||||||
if self.ch_is(']') {
|
if self.ch_is(']') {
|
||||||
self.bump();
|
self.bump();
|
||||||
return Ok(List(values));
|
return Ok(List(values.move_iter().collect()));
|
||||||
}
|
}
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
@ -1252,7 +1252,7 @@ impl<T : Iterator<char>> Parser<T> {
|
|||||||
self.bump();
|
self.bump();
|
||||||
} else if self.ch_is(']') {
|
} else if self.ch_is(']') {
|
||||||
self.bump();
|
self.bump();
|
||||||
return Ok(List(values));
|
return Ok(List(values.move_iter().collect()));
|
||||||
} else {
|
} else {
|
||||||
return self.error(~"expected `,` or `]`")
|
return self.error(~"expected `,` or `]`")
|
||||||
}
|
}
|
||||||
@ -1332,14 +1332,14 @@ pub fn from_str(s: &str) -> DecodeResult<Json> {
|
|||||||
|
|
||||||
/// A structure to decode JSON to values in rust.
|
/// A structure to decode JSON to values in rust.
|
||||||
pub struct Decoder {
|
pub struct Decoder {
|
||||||
stack: ~[Json],
|
stack: Vec<Json>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Decoder {
|
impl Decoder {
|
||||||
/// Creates a new decoder instance for decoding the specified JSON value.
|
/// Creates a new decoder instance for decoding the specified JSON value.
|
||||||
pub fn new(json: Json) -> Decoder {
|
pub fn new(json: Json) -> Decoder {
|
||||||
Decoder {
|
Decoder {
|
||||||
stack: ~[json]
|
stack: vec!(json),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,6 @@ Core encoding and decoding interfaces.
|
|||||||
|
|
||||||
use std::path;
|
use std::path;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::slice;
|
|
||||||
|
|
||||||
pub trait Encoder<E> {
|
pub trait Encoder<E> {
|
||||||
// Primitive types:
|
// Primitive types:
|
||||||
@ -443,11 +442,15 @@ impl<E, S:Encoder<E>,T:Encodable<S, E>> Encodable<S, E> for ~[T] {
|
|||||||
impl<E, D:Decoder<E>,T:Decodable<D, E>> Decodable<D, E> for ~[T] {
|
impl<E, D:Decoder<E>,T:Decodable<D, E>> Decodable<D, E> for ~[T] {
|
||||||
fn decode(d: &mut D) -> Result<~[T], E> {
|
fn decode(d: &mut D) -> Result<~[T], E> {
|
||||||
d.read_seq(|d, len| {
|
d.read_seq(|d, len| {
|
||||||
let mut v: ~[T] = slice::with_capacity(len);
|
let mut v: Vec<T> = Vec::with_capacity(len);
|
||||||
for i in range(0, len) {
|
for i in range(0, len) {
|
||||||
v.push(try!(d.read_seq_elt(i, |d| Decodable::decode(d))));
|
v.push(try!(d.read_seq_elt(i, |d| Decodable::decode(d))));
|
||||||
}
|
}
|
||||||
Ok(v)
|
println!("-------");
|
||||||
|
println!("{}", v.len());
|
||||||
|
let k = v.move_iter().collect::<~[T]>();
|
||||||
|
println!("{}", k.len());
|
||||||
|
Ok(k)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -594,11 +597,11 @@ pub trait DecoderHelpers<E> {
|
|||||||
impl<E, D:Decoder<E>> DecoderHelpers<E> for D {
|
impl<E, D:Decoder<E>> DecoderHelpers<E> for D {
|
||||||
fn read_to_vec<T>(&mut self, f: |&mut D| -> Result<T, E>) -> Result<~[T], E> {
|
fn read_to_vec<T>(&mut self, f: |&mut D| -> Result<T, E>) -> Result<~[T], E> {
|
||||||
self.read_seq(|this, len| {
|
self.read_seq(|this, len| {
|
||||||
let mut v = slice::with_capacity(len);
|
let mut v = Vec::with_capacity(len);
|
||||||
for i in range(0, len) {
|
for i in range(0, len) {
|
||||||
v.push(try!(this.read_seq_elt(i, |this| f(this))));
|
v.push(try!(this.read_seq_elt(i, |this| f(this))));
|
||||||
}
|
}
|
||||||
Ok(v)
|
Ok(v.move_iter().collect())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,9 +28,6 @@
|
|||||||
|
|
||||||
#![allow(missing_doc)]
|
#![allow(missing_doc)]
|
||||||
|
|
||||||
#[cfg(windows)]
|
|
||||||
use iter::range;
|
|
||||||
|
|
||||||
use clone::Clone;
|
use clone::Clone;
|
||||||
use container::Container;
|
use container::Container;
|
||||||
use libc;
|
use libc;
|
||||||
@ -96,15 +93,16 @@ pub fn getcwd() -> Path {
|
|||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
pub mod win32 {
|
pub mod win32 {
|
||||||
|
use iter::Iterator;
|
||||||
use libc::types::os::arch::extra::DWORD;
|
use libc::types::os::arch::extra::DWORD;
|
||||||
use libc;
|
use libc;
|
||||||
use option::{None, Option};
|
use option::{None, Option};
|
||||||
use option;
|
use option;
|
||||||
use os::TMPBUF_SZ;
|
use os::TMPBUF_SZ;
|
||||||
|
use slice::{MutableVector, ImmutableVector, OwnedVector};
|
||||||
use str::StrSlice;
|
use str::StrSlice;
|
||||||
use str;
|
use str;
|
||||||
use slice::{MutableVector, ImmutableVector, OwnedVector};
|
use vec::Vec;
|
||||||
use slice;
|
|
||||||
|
|
||||||
pub fn fill_utf16_buf_and_decode(f: |*mut u16, DWORD| -> DWORD)
|
pub fn fill_utf16_buf_and_decode(f: |*mut u16, DWORD| -> DWORD)
|
||||||
-> Option<~str> {
|
-> Option<~str> {
|
||||||
@ -114,7 +112,7 @@ pub mod win32 {
|
|||||||
let mut res = None;
|
let mut res = None;
|
||||||
let mut done = false;
|
let mut done = false;
|
||||||
while !done {
|
while !done {
|
||||||
let mut buf = slice::from_elem(n as uint, 0u16);
|
let mut buf = Vec::from_elem(n as uint, 0u16);
|
||||||
let k = f(buf.as_mut_ptr(), n);
|
let k = f(buf.as_mut_ptr(), n);
|
||||||
if k == (0 as DWORD) {
|
if k == (0 as DWORD) {
|
||||||
done = true;
|
done = true;
|
||||||
@ -142,7 +140,7 @@ pub mod win32 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn as_utf16_p<T>(s: &str, f: |*u16| -> T) -> T {
|
pub fn as_utf16_p<T>(s: &str, f: |*u16| -> T) -> T {
|
||||||
let mut t = s.to_utf16();
|
let mut t = s.to_utf16().move_iter().collect::<Vec<u16>>();
|
||||||
// Null terminate before passing on.
|
// Null terminate before passing on.
|
||||||
t.push(0u16);
|
t.push(0u16);
|
||||||
f(t.as_ptr())
|
f(t.as_ptr())
|
||||||
@ -182,7 +180,7 @@ pub fn env() -> ~[(~str,~str)] {
|
|||||||
pub fn env_as_bytes() -> ~[(~[u8],~[u8])] {
|
pub fn env_as_bytes() -> ~[(~[u8],~[u8])] {
|
||||||
unsafe {
|
unsafe {
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
unsafe fn get_env_pairs() -> ~[~[u8]] {
|
unsafe fn get_env_pairs() -> Vec<~[u8]> {
|
||||||
use c_str;
|
use c_str;
|
||||||
use str::StrSlice;
|
use str::StrSlice;
|
||||||
|
|
||||||
@ -195,7 +193,7 @@ pub fn env_as_bytes() -> ~[(~[u8],~[u8])] {
|
|||||||
fail!("os::env() failure getting env string from OS: {}",
|
fail!("os::env() failure getting env string from OS: {}",
|
||||||
os::last_os_error());
|
os::last_os_error());
|
||||||
}
|
}
|
||||||
let mut result = ~[];
|
let mut result = Vec::new();
|
||||||
c_str::from_c_multistring(ch as *c_char, None, |cstr| {
|
c_str::from_c_multistring(ch as *c_char, None, |cstr| {
|
||||||
result.push(cstr.as_bytes_no_nul().to_owned());
|
result.push(cstr.as_bytes_no_nul().to_owned());
|
||||||
});
|
});
|
||||||
@ -839,27 +837,24 @@ fn real_args() -> ~[~str] {
|
|||||||
let lpCmdLine = unsafe { GetCommandLineW() };
|
let lpCmdLine = unsafe { GetCommandLineW() };
|
||||||
let szArgList = unsafe { CommandLineToArgvW(lpCmdLine, lpArgCount) };
|
let szArgList = unsafe { CommandLineToArgvW(lpCmdLine, lpArgCount) };
|
||||||
|
|
||||||
let mut args = ~[];
|
let args = Vec::from_fn(nArgs as uint, |i| unsafe {
|
||||||
for i in range(0u, nArgs as uint) {
|
// Determine the length of this argument.
|
||||||
unsafe {
|
let ptr = *szArgList.offset(i as int);
|
||||||
// Determine the length of this argument.
|
let mut len = 0;
|
||||||
let ptr = *szArgList.offset(i as int);
|
while *ptr.offset(len as int) != 0 { len += 1; }
|
||||||
let mut len = 0;
|
|
||||||
while *ptr.offset(len as int) != 0 { len += 1; }
|
|
||||||
|
|
||||||
// Push it onto the list.
|
// Push it onto the list.
|
||||||
let opt_s = slice::raw::buf_as_slice(ptr, len, |buf| {
|
let opt_s = slice::raw::buf_as_slice(ptr, len, |buf| {
|
||||||
str::from_utf16(str::truncate_utf16_at_nul(buf))
|
str::from_utf16(str::truncate_utf16_at_nul(buf))
|
||||||
});
|
});
|
||||||
args.push(opt_s.expect("CommandLineToArgvW returned invalid UTF-16"));
|
opt_s.expect("CommandLineToArgvW returned invalid UTF-16")
|
||||||
}
|
});
|
||||||
}
|
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
LocalFree(szArgList as *c_void);
|
LocalFree(szArgList as *c_void);
|
||||||
}
|
}
|
||||||
|
|
||||||
return args;
|
return args.move_iter().collect();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
|
@ -20,7 +20,6 @@ use rsparse = parse;
|
|||||||
|
|
||||||
use std::fmt::parse;
|
use std::fmt::parse;
|
||||||
use collections::{HashMap, HashSet};
|
use collections::{HashMap, HashSet};
|
||||||
use std::slice;
|
|
||||||
|
|
||||||
#[deriving(Eq)]
|
#[deriving(Eq)]
|
||||||
enum ArgumentType {
|
enum ArgumentType {
|
||||||
@ -609,7 +608,7 @@ impl<'a, 'b> Context<'a, 'b> {
|
|||||||
fn to_expr(&self, extra: @ast::Expr) -> @ast::Expr {
|
fn to_expr(&self, extra: @ast::Expr) -> @ast::Expr {
|
||||||
let mut lets = Vec::new();
|
let mut lets = Vec::new();
|
||||||
let mut locals = Vec::new();
|
let mut locals = Vec::new();
|
||||||
let mut names = slice::from_fn(self.name_positions.len(), |_| None);
|
let mut names = Vec::from_fn(self.name_positions.len(), |_| None);
|
||||||
let mut pats = Vec::new();
|
let mut pats = Vec::new();
|
||||||
let mut heads = Vec::new();
|
let mut heads = Vec::new();
|
||||||
|
|
||||||
@ -673,7 +672,7 @@ impl<'a, 'b> Context<'a, 'b> {
|
|||||||
let lname = self.ecx.ident_of(format!("__arg{}", *name));
|
let lname = self.ecx.ident_of(format!("__arg{}", *name));
|
||||||
pats.push(self.ecx.pat_ident(e.span, lname));
|
pats.push(self.ecx.pat_ident(e.span, lname));
|
||||||
heads.push(self.ecx.expr_addr_of(e.span, e));
|
heads.push(self.ecx.expr_addr_of(e.span, e));
|
||||||
names[*self.name_positions.get(name)] =
|
*names.get_mut(*self.name_positions.get(name)) =
|
||||||
Some(self.format_arg(e.span,
|
Some(self.format_arg(e.span,
|
||||||
Named((*name).clone()),
|
Named((*name).clone()),
|
||||||
self.ecx.expr_ident(e.span, lname)));
|
self.ecx.expr_ident(e.span, lname)));
|
||||||
|
@ -16,7 +16,6 @@ use collections::{TrieMap, TreeMap, HashMap, HashSet};
|
|||||||
use std::os;
|
use std::os;
|
||||||
use rand::{Rng, IsaacRng, SeedableRng};
|
use rand::{Rng, IsaacRng, SeedableRng};
|
||||||
use std::uint;
|
use std::uint;
|
||||||
use std::slice;
|
|
||||||
|
|
||||||
fn timed(label: &str, f: ||) {
|
fn timed(label: &str, f: ||) {
|
||||||
let start = time::precise_time_s();
|
let start = time::precise_time_s();
|
||||||
@ -99,7 +98,7 @@ fn main() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut rand = slice::with_capacity(n_keys);
|
let mut rand = Vec::with_capacity(n_keys);
|
||||||
|
|
||||||
{
|
{
|
||||||
let mut rng: IsaacRng = SeedableRng::from_seed(&[1, 1, 1, 1, 1, 1, 1]);
|
let mut rng: IsaacRng = SeedableRng::from_seed(&[1, 1, 1, 1, 1, 1, 1]);
|
||||||
@ -130,7 +129,7 @@ fn main() {
|
|||||||
{
|
{
|
||||||
println!(" Random integers:");
|
println!(" Random integers:");
|
||||||
let mut map: TreeMap<uint,uint> = TreeMap::new();
|
let mut map: TreeMap<uint,uint> = TreeMap::new();
|
||||||
vector(&mut map, n_keys, rand);
|
vector(&mut map, n_keys, rand.as_slice());
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: #9970
|
// FIXME: #9970
|
||||||
@ -149,7 +148,7 @@ fn main() {
|
|||||||
{
|
{
|
||||||
println!(" Random integers:");
|
println!(" Random integers:");
|
||||||
let mut map: HashMap<uint,uint> = HashMap::new();
|
let mut map: HashMap<uint,uint> = HashMap::new();
|
||||||
vector(&mut map, n_keys, rand);
|
vector(&mut map, n_keys, rand.as_slice());
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: #9970
|
// FIXME: #9970
|
||||||
@ -168,6 +167,6 @@ fn main() {
|
|||||||
{
|
{
|
||||||
println!(" Random integers:");
|
println!(" Random integers:");
|
||||||
let mut map: TrieMap<uint> = TrieMap::new();
|
let mut map: TrieMap<uint> = TrieMap::new();
|
||||||
vector(&mut map, n_keys, rand);
|
vector(&mut map, n_keys, rand.as_slice());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
use std::os;
|
use std::os;
|
||||||
use std::slice;
|
|
||||||
|
|
||||||
fn max(a: i32, b: i32) -> i32 {
|
fn max(a: i32, b: i32) -> i32 {
|
||||||
if a > b {
|
if a > b {
|
||||||
@ -20,13 +19,17 @@ fn max(a: i32, b: i32) -> i32 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn fannkuch_redux(n: i32) -> i32 {
|
fn fannkuch_redux(n: i32) -> i32 {
|
||||||
let mut perm = slice::from_elem(n as uint, 0i32);
|
let mut perm = Vec::from_elem(n as uint, 0i32);
|
||||||
let mut perm1 = slice::from_fn(n as uint, |i| i as i32);
|
let mut perm1 = Vec::from_fn(n as uint, |i| i as i32);
|
||||||
let mut count = slice::from_elem(n as uint, 0i32);
|
let mut count = Vec::from_elem(n as uint, 0i32);
|
||||||
let mut max_flips_count = 0i32;
|
let mut max_flips_count = 0i32;
|
||||||
let mut perm_count = 0i32;
|
let mut perm_count = 0i32;
|
||||||
let mut checksum = 0i32;
|
let mut checksum = 0i32;
|
||||||
|
|
||||||
|
let perm = perm.as_mut_slice();
|
||||||
|
let perm1 = perm1.as_mut_slice();
|
||||||
|
let count = count.as_mut_slice();
|
||||||
|
|
||||||
let mut r = n;
|
let mut r = n;
|
||||||
loop {
|
loop {
|
||||||
while r != 1 {
|
while r != 1 {
|
||||||
|
@ -12,7 +12,6 @@ use std::cmp::min;
|
|||||||
use std::io::{stdout, IoResult};
|
use std::io::{stdout, IoResult};
|
||||||
use std::os;
|
use std::os;
|
||||||
use std::slice::bytes::copy_memory;
|
use std::slice::bytes::copy_memory;
|
||||||
use std::slice;
|
|
||||||
|
|
||||||
static LINE_LEN: uint = 60;
|
static LINE_LEN: uint = 60;
|
||||||
static LOOKUP_SIZE: uint = 4 * 1024;
|
static LOOKUP_SIZE: uint = 4 * 1024;
|
||||||
@ -90,10 +89,10 @@ impl<'a, W: Writer> RepeatFasta<'a, W> {
|
|||||||
|
|
||||||
fn make(&mut self, n: uint) -> IoResult<()> {
|
fn make(&mut self, n: uint) -> IoResult<()> {
|
||||||
let alu_len = self.alu.len();
|
let alu_len = self.alu.len();
|
||||||
let mut buf = slice::from_elem(alu_len + LINE_LEN, 0u8);
|
let mut buf = Vec::from_elem(alu_len + LINE_LEN, 0u8);
|
||||||
let alu: &[u8] = self.alu.as_bytes();
|
let alu: &[u8] = self.alu.as_bytes();
|
||||||
|
|
||||||
copy_memory(buf, alu);
|
copy_memory(buf.as_mut_slice(), alu);
|
||||||
let buf_len = buf.len();
|
let buf_len = buf.len();
|
||||||
copy_memory(buf.mut_slice(alu_len, buf_len),
|
copy_memory(buf.mut_slice(alu_len, buf_len),
|
||||||
alu.slice_to(LINE_LEN));
|
alu.slice_to(LINE_LEN));
|
||||||
|
@ -14,7 +14,6 @@ use std::from_str::FromStr;
|
|||||||
use std::iter::count;
|
use std::iter::count;
|
||||||
use std::cmp::min;
|
use std::cmp::min;
|
||||||
use std::os;
|
use std::os;
|
||||||
use std::slice::from_elem;
|
|
||||||
use sync::{Arc, RWLock};
|
use sync::{Arc, RWLock};
|
||||||
|
|
||||||
fn A(i: uint, j: uint) -> f64 {
|
fn A(i: uint, j: uint) -> f64 {
|
||||||
|
@ -13,5 +13,4 @@
|
|||||||
fn main() {
|
fn main() {
|
||||||
~[1]; //~ ERROR use of deprecated `~[]`
|
~[1]; //~ ERROR use of deprecated `~[]`
|
||||||
//~^ ERROR use of deprecated `~[]`
|
//~^ ERROR use of deprecated `~[]`
|
||||||
std::slice::with_capacity::<int>(10); //~ ERROR use of deprecated `~[]`
|
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,12 @@ use test::B;
|
|||||||
|
|
||||||
// Make sure this import is warned about when at least one of its imported names
|
// Make sure this import is warned about when at least one of its imported names
|
||||||
// is unused
|
// is unused
|
||||||
use std::slice::{from_fn, from_elem}; //~ ERROR unused import
|
use test2::{foo, bar}; //~ ERROR unused import
|
||||||
|
|
||||||
|
mod test2 {
|
||||||
|
pub fn foo() {}
|
||||||
|
pub fn bar() {}
|
||||||
|
}
|
||||||
|
|
||||||
mod test {
|
mod test {
|
||||||
pub trait A { fn a(&self) {} }
|
pub trait A { fn a(&self) {} }
|
||||||
@ -66,5 +71,5 @@ fn main() {
|
|||||||
let mut b = 4;
|
let mut b = 4;
|
||||||
swap(&mut a, &mut b);
|
swap(&mut a, &mut b);
|
||||||
test::C.b();
|
test::C.b();
|
||||||
let _a = from_elem(0, 0);
|
let _a = foo();
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ fn double() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn runtest(me: &str) {
|
fn runtest(me: &str) {
|
||||||
let mut env = os::env();
|
let mut env = os::env().move_iter().collect::<Vec<(~str, ~str)>>();
|
||||||
match env.iter().position(|&(ref s, _)| "RUST_BACKTRACE" == *s) {
|
match env.iter().position(|&(ref s, _)| "RUST_BACKTRACE" == *s) {
|
||||||
Some(i) => { env.remove(i); }
|
Some(i) => { env.remove(i); }
|
||||||
None => {}
|
None => {}
|
||||||
|
Loading…
Reference in New Issue
Block a user