Update the rest of the compiler with ~[T] changes
This commit is contained in:
parent
7d3b0bf391
commit
675b82657e
35 changed files with 140 additions and 166 deletions
|
|
@ -156,8 +156,6 @@ pub fn minimize_rpaths(rpaths: &[~str]) -> Vec<~str> {
|
|||
|
||||
#[cfg(unix, test)]
|
||||
mod test {
|
||||
use std::os;
|
||||
|
||||
use back::rpath::get_install_prefix_rpath;
|
||||
use back::rpath::{minimize_rpaths, rpaths_to_flags, get_rpath_relative_to_output};
|
||||
use syntax::abi;
|
||||
|
|
|
|||
|
|
@ -223,13 +223,13 @@ pub fn describe_codegen_flags() {
|
|||
}
|
||||
|
||||
pub fn run_compiler(args: &[~str]) {
|
||||
let mut args = args.to_owned();
|
||||
let mut args = Vec::from_slice(args);
|
||||
let binary = args.shift().unwrap();
|
||||
|
||||
if args.is_empty() { usage(binary); return; }
|
||||
|
||||
let matches =
|
||||
&match getopts::getopts(args, d::optgroups().as_slice()) {
|
||||
&match getopts::getopts(args.as_slice(), d::optgroups().as_slice()) {
|
||||
Ok(m) => m,
|
||||
Err(f) => {
|
||||
d::early_error(f.to_err_msg());
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
|
||||
|
||||
use std::io;
|
||||
use std::slice;
|
||||
use std::strbuf::StrBuf;
|
||||
use std::uint;
|
||||
use syntax::ast;
|
||||
|
|
@ -308,13 +307,13 @@ impl<'a, O:DataFlowOperator+Clone+'static> DataFlowContext<'a, O> {
|
|||
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();
|
||||
|
||||
while propcx.changed {
|
||||
propcx.changed = false;
|
||||
propcx.reset(temp);
|
||||
propcx.walk_block(blk, temp, &mut loop_scopes);
|
||||
propcx.reset(temp.as_mut_slice());
|
||||
propcx.walk_block(blk, temp.as_mut_slice(), &mut loop_scopes);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,8 +16,6 @@
|
|||
* closure.
|
||||
*/
|
||||
|
||||
use std::slice;
|
||||
|
||||
use back::abi;
|
||||
use driver::session;
|
||||
use lib::llvm::{ValueRef, NoAliasAttribute, StructRetAttribute, NoCaptureAttribute};
|
||||
|
|
@ -221,11 +219,12 @@ fn resolve_default_method_vtables(bcx: &Block,
|
|||
Some(vtables) => {
|
||||
let num_impl_type_parameters =
|
||||
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 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,
|
||||
_ => 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) {
|
||||
C_struct(cx, vs, false)
|
||||
C_struct(cx, vs.as_slice(), false)
|
||||
} else {
|
||||
C_array(llunitty, vs)
|
||||
C_array(llunitty, vs.as_slice())
|
||||
};
|
||||
(v, true)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -148,7 +148,6 @@ use collections::HashMap;
|
|||
use collections::HashSet;
|
||||
use libc::{c_uint, c_ulonglong, c_longlong};
|
||||
use std::ptr;
|
||||
use std::slice;
|
||||
use std::strbuf::StrBuf;
|
||||
use std::sync::atomics;
|
||||
use syntax::codemap::{Span, Pos};
|
||||
|
|
@ -776,7 +775,7 @@ pub fn create_function_debug_context(cx: &CrateContext,
|
|||
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
|
||||
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));
|
||||
}
|
||||
|
||||
return create_DIArray(DIB(cx), signature);
|
||||
return create_DIArray(DIB(cx), signature.as_slice());
|
||||
}
|
||||
|
||||
fn get_template_parameters(cx: &CrateContext,
|
||||
|
|
@ -961,7 +960,7 @@ fn compile_unit_metadata(cx: &CrateContext) {
|
|||
// prepend "./" if necessary
|
||||
let dotdot = bytes!("..");
|
||||
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 &&
|
||||
path_bytes.slice_to(2) != dotdot {
|
||||
|
|
@ -969,7 +968,7 @@ fn compile_unit_metadata(cx: &CrateContext) {
|
|||
path_bytes.insert(1, prefix[1]);
|
||||
}
|
||||
|
||||
path_bytes.to_c_str()
|
||||
path_bytes.as_slice().to_c_str()
|
||||
}
|
||||
_ => fallback_path(cx)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,7 +71,6 @@ use util::nodemap::NodeMap;
|
|||
use middle::trans::machine::{llsize_of, llsize_of_alloc};
|
||||
use middle::trans::type_::Type;
|
||||
|
||||
use std::slice;
|
||||
use syntax::ast;
|
||||
use syntax::codemap;
|
||||
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 tcx = bcx.tcx();
|
||||
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 opt_pos =
|
||||
|
|
@ -977,7 +976,7 @@ fn trans_rec_or_struct<'a>(
|
|||
field_ty.ident.name == field.ident.node.name);
|
||||
match opt_pos {
|
||||
Some(i) => {
|
||||
need_base[i] = false;
|
||||
*need_base.get_mut(i) = false;
|
||||
(i, field.expr)
|
||||
}
|
||||
None => {
|
||||
|
|
|
|||
|
|
@ -118,7 +118,6 @@ use std::cell::{Cell, RefCell};
|
|||
use collections::HashMap;
|
||||
use std::mem::replace;
|
||||
use std::result;
|
||||
use std::slice;
|
||||
use std::vec::Vec;
|
||||
use syntax::abi;
|
||||
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
|
||||
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| {
|
||||
match ty::get(t).sty {
|
||||
ty::ty_param(param_ty {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::uint;
|
||||
use std::slice;
|
||||
use collections::{HashMap, HashSet};
|
||||
use syntax::ast;
|
||||
|
||||
|
|
@ -1004,7 +1003,7 @@ impl<'a> RegionVarBindings<'a> {
|
|||
// idea is to report errors that derive from independent
|
||||
// regions of the graph, but not those that derive from
|
||||
// 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;
|
||||
|
||||
|
|
@ -1052,11 +1051,13 @@ impl<'a> RegionVarBindings<'a> {
|
|||
match var_data[idx].classification {
|
||||
Expanding => {
|
||||
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 => {
|
||||
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 std::num::Bounded;
|
||||
use std::slice;
|
||||
use self::rand::isaac::IsaacRng;
|
||||
use self::rand::Rng;
|
||||
use serialize::hex::FromHex;
|
||||
|
|
@ -600,7 +599,7 @@ mod tests {
|
|||
/// correct.
|
||||
fn test_digest_1million_random<D: Digest>(digest: &mut D, blocksize: uint, expected: &str) {
|
||||
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 count = 0;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue