Rename vec::len(var) to var.len()

This commit is contained in:
Youngmin Yoo 2013-05-14 18:52:12 +09:00
parent c30414f980
commit a2a8596c3d
58 changed files with 128 additions and 134 deletions

BIN
.swo Normal file

Binary file not shown.

View file

@ -264,7 +264,7 @@ fn run_debuginfo_test(config: &config, props: &TestProps, testfile: &Path) {
fatal(~"gdb failed to execute"); fatal(~"gdb failed to execute");
} }
let num_check_lines = vec::len(check_lines); let num_check_lines = check_lines.len();
if num_check_lines > 0 { if num_check_lines > 0 {
// check if each line in props.check_lines appears in the // check if each line in props.check_lines appears in the
// output (in order) // output (in order)
@ -303,7 +303,7 @@ fn check_error_patterns(props: &TestProps,
if str::contains(line, *next_err_pat) { if str::contains(line, *next_err_pat) {
debug!("found error pattern %s", *next_err_pat); debug!("found error pattern %s", *next_err_pat);
next_err_idx += 1u; next_err_idx += 1u;
if next_err_idx == vec::len(props.error_patterns) { if next_err_idx == props.error_patterns.len() {
debug!("found all error patterns"); debug!("found all error patterns");
done = true; done = true;
break; break;
@ -315,8 +315,8 @@ fn check_error_patterns(props: &TestProps,
let missing_patterns = let missing_patterns =
vec::slice(props.error_patterns, next_err_idx, vec::slice(props.error_patterns, next_err_idx,
vec::len(props.error_patterns)); props.error_patterns.len());
if vec::len(missing_patterns) == 1u { if missing_patterns.len() == 1u {
fatal_ProcRes(fmt!("error pattern '%s' not found!", fatal_ProcRes(fmt!("error pattern '%s' not found!",
missing_patterns[0]), ProcRes); missing_patterns[0]), ProcRes);
} else { } else {
@ -333,7 +333,7 @@ fn check_expected_errors(expected_errors: ~[errors::ExpectedError],
// true if we found the error in question // true if we found the error in question
let mut found_flags = vec::from_elem( let mut found_flags = vec::from_elem(
vec::len(expected_errors), false); expected_errors.len(), false);
if ProcRes.status == 0 { if ProcRes.status == 0 {
fatal(~"process did not return an error status"); fatal(~"process did not return an error status");
@ -377,7 +377,7 @@ fn check_expected_errors(expected_errors: ~[errors::ExpectedError],
} }
} }
for uint::range(0u, vec::len(found_flags)) |i| { for uint::range(0u, found_flags.len()) |i| {
if !found_flags[i] { if !found_flags[i] {
let ee = &expected_errors[i]; let ee = &expected_errors[i];
fatal_ProcRes(fmt!("expected %s on line %u not found: %s", fatal_ProcRes(fmt!("expected %s on line %u not found: %s",

View file

@ -201,14 +201,14 @@ fn test_lefts() {
fn test_lefts_none() { fn test_lefts_none() {
let input: ~[Either<int, int>] = ~[Right(10), Right(10)]; let input: ~[Either<int, int>] = ~[Right(10), Right(10)];
let result = lefts(input); let result = lefts(input);
assert_eq!(vec::len(result), 0u); assert_eq!(result.len(), 0u);
} }
#[test] #[test]
fn test_lefts_empty() { fn test_lefts_empty() {
let input: ~[Either<int, int>] = ~[]; let input: ~[Either<int, int>] = ~[];
let result = lefts(input); let result = lefts(input);
assert_eq!(vec::len(result), 0u); assert_eq!(result.len(), 0u);
} }
#[test] #[test]
@ -222,14 +222,14 @@ fn test_rights() {
fn test_rights_none() { fn test_rights_none() {
let input: ~[Either<int, int>] = ~[Left(10), Left(10)]; let input: ~[Either<int, int>] = ~[Left(10), Left(10)];
let result = rights(input); let result = rights(input);
assert_eq!(vec::len(result), 0u); assert_eq!(result.len(), 0u);
} }
#[test] #[test]
fn test_rights_empty() { fn test_rights_empty() {
let input: ~[Either<int, int>] = ~[]; let input: ~[Either<int, int>] = ~[];
let result = rights(input); let result = rights(input);
assert_eq!(vec::len(result), 0u); assert_eq!(result.len(), 0u);
} }
#[test] #[test]
@ -247,22 +247,22 @@ fn test_partition() {
fn test_partition_no_lefts() { fn test_partition_no_lefts() {
let input: ~[Either<int, int>] = ~[Right(10), Right(11)]; let input: ~[Either<int, int>] = ~[Right(10), Right(11)];
let (lefts, rights) = partition(input); let (lefts, rights) = partition(input);
assert_eq!(vec::len(lefts), 0u); assert_eq!(lefts.len(), 0u);
assert_eq!(vec::len(rights), 2u); assert_eq!(rights.len(), 2u);
} }
#[test] #[test]
fn test_partition_no_rights() { fn test_partition_no_rights() {
let input: ~[Either<int, int>] = ~[Left(10), Left(11)]; let input: ~[Either<int, int>] = ~[Left(10), Left(11)];
let (lefts, rights) = partition(input); let (lefts, rights) = partition(input);
assert_eq!(vec::len(lefts), 2u); assert_eq!(lefts.len(), 2u);
assert_eq!(vec::len(rights), 0u); assert_eq!(rights.len(), 0u);
} }
#[test] #[test]
fn test_partition_empty() { fn test_partition_empty() {
let input: ~[Either<int, int>] = ~[]; let input: ~[Either<int, int>] = ~[];
let (lefts, rights) = partition(input); let (lefts, rights) = partition(input);
assert_eq!(vec::len(lefts), 0u); assert_eq!(lefts.len(), 0u);
assert_eq!(vec::len(rights), 0u); assert_eq!(rights.len(), 0u);
} }

View file

@ -673,10 +673,10 @@ impl<T:Reader> ReaderUtil for T {
fn read_char(&self) -> char { fn read_char(&self) -> char {
let c = self.read_chars(1); let c = self.read_chars(1);
if vec::len(c) == 0 { if c.len() == 0 {
return -1 as char; // FIXME will this stay valid? // #2004 return -1 as char; // FIXME will this stay valid? // #2004
} }
assert!((vec::len(c) == 1)); assert!(c.len() == 1);
return c[0]; return c[0];
} }
@ -1802,7 +1802,7 @@ mod tests {
fn test_readchars_empty() { fn test_readchars_empty() {
do io::with_str_reader(~"") |inp| { do io::with_str_reader(~"") |inp| {
let res : ~[char] = inp.read_chars(128); let res : ~[char] = inp.read_chars(128);
assert!((vec::len(res) == 0)); assert!(res.len() == 0);
} }
} }
@ -1841,10 +1841,10 @@ mod tests {
fn check_read_ln(len : uint, s: &str, ivals: &[int]) { fn check_read_ln(len : uint, s: &str, ivals: &[int]) {
do io::with_str_reader(s) |inp| { do io::with_str_reader(s) |inp| {
let res : ~[char] = inp.read_chars(len); let res : ~[char] = inp.read_chars(len);
if (len <= vec::len(ivals)) { if len <= ivals.len() {
assert!((vec::len(res) == len)); assert!(res.len() == len);
} }
assert!(vec::slice(ivals, 0u, vec::len(res)) == assert!(vec::slice(ivals, 0u, res.len()) ==
vec::map(res, |x| *x as int)); vec::map(res, |x| *x as int));
} }
} }

View file

@ -410,7 +410,7 @@ pub fn self_exe_path() -> Option<Path> {
KERN_PROC as c_int, KERN_PROC as c_int,
KERN_PROC_PATHNAME as c_int, -1 as c_int]; KERN_PROC_PATHNAME as c_int, -1 as c_int];
let mut sz = sz; let mut sz = sz;
sysctl(vec::raw::to_ptr(mib), vec::len(mib) as ::libc::c_uint, sysctl(vec::raw::to_ptr(mib), mib.len() as ::libc::c_uint,
buf as *mut c_void, &mut sz, ptr::null(), buf as *mut c_void, &mut sz, ptr::null(),
0u as size_t) == (0 as c_int) 0u as size_t) == (0 as c_int)
} }
@ -1490,7 +1490,7 @@ mod tests {
#[ignore] #[ignore]
fn test_env_getenv() { fn test_env_getenv() {
let e = env(); let e = env();
assert!(vec::len(e) > 0u); assert!(e.len() > 0u);
for e.each |p| { for e.each |p| {
let (n, v) = copy *p; let (n, v) = copy *p;
debug!(copy n); debug!(copy n);
@ -1581,7 +1581,7 @@ mod tests {
fn list_dir() { fn list_dir() {
let dirs = os::list_dir(&Path(".")); let dirs = os::list_dir(&Path("."));
// Just assuming that we've got some contents in the current directory // Just assuming that we've got some contents in the current directory
assert!((vec::len(dirs) > 0u)); assert!(dirs.len() > 0u);
for dirs.each |dir| { for dirs.each |dir| {
debug!(copy *dir); debug!(copy *dir);

View file

@ -441,7 +441,7 @@ pub mod ptr_tests {
let arr_ptr = &arr[0]; let arr_ptr = &arr[0];
let mut ctr = 0; let mut ctr = 0;
let mut iteration_count = 0; let mut iteration_count = 0;
array_each_with_len(arr_ptr, vec::len(arr), array_each_with_len(arr_ptr, arr.len(),
|e| { |e| {
let actual = str::raw::from_c_str(e); let actual = str::raw::from_c_str(e);
let expected = copy expected_arr[ctr]; let expected = copy expected_arr[ctr];

View file

@ -221,7 +221,7 @@ pub unsafe fn accept(server: *c_void, client: *c_void) -> c_int {
pub unsafe fn write<T>(req: *uv_write_t, stream: *T, buf_in: &[uv_buf_t], cb: *u8) -> c_int { pub unsafe fn write<T>(req: *uv_write_t, stream: *T, buf_in: &[uv_buf_t], cb: *u8) -> c_int {
let buf_ptr = vec::raw::to_ptr(buf_in); let buf_ptr = vec::raw::to_ptr(buf_in);
let buf_cnt = vec::len(buf_in) as i32; let buf_cnt = buf_in.len() as i32;
return rust_uv_write(req as *c_void, stream as *c_void, buf_ptr, buf_cnt, cb); return rust_uv_write(req as *c_void, stream as *c_void, buf_ptr, buf_cnt, cb);
} }
pub unsafe fn read_start(stream: *uv_stream_t, on_alloc: *u8, on_read: *u8) -> c_int { pub unsafe fn read_start(stream: *uv_stream_t, on_alloc: *u8, on_read: *u8) -> c_int {

View file

@ -2059,7 +2059,7 @@ pub fn is_utf8(v: &const [u8]) -> bool {
/// Determines if a vector of `u16` contains valid UTF-16 /// Determines if a vector of `u16` contains valid UTF-16
pub fn is_utf16(v: &[u16]) -> bool { pub fn is_utf16(v: &[u16]) -> bool {
let len = vec::len(v); let len = v.len();
let mut i = 0u; let mut i = 0u;
while (i < len) { while (i < len) {
let u = v[i]; let u = v[i];
@ -2103,7 +2103,7 @@ pub fn to_utf16(s: &str) -> ~[u16] {
} }
pub fn utf16_chars(v: &[u16], f: &fn(char)) { pub fn utf16_chars(v: &[u16], f: &fn(char)) {
let len = vec::len(v); let len = v.len();
let mut i = 0u; let mut i = 0u;
while (i < len && v[i] != 0u16) { while (i < len && v[i] != 0u16) {
let u = v[i]; let u = v[i];
@ -2128,7 +2128,7 @@ pub fn utf16_chars(v: &[u16], f: &fn(char)) {
pub fn from_utf16(v: &[u16]) -> ~str { pub fn from_utf16(v: &[u16]) -> ~str {
let mut buf = ~""; let mut buf = ~"";
reserve(&mut buf, vec::len(v)); reserve(&mut buf, v.len());
utf16_chars(v, |ch| push_char(&mut buf, ch)); utf16_chars(v, |ch| push_char(&mut buf, ch));
buf buf
} }
@ -2398,7 +2398,7 @@ static tag_six_b: uint = 252u;
* # Example * # Example
* *
* ~~~ * ~~~
* let i = str::as_bytes("Hello World") { |bytes| vec::len(bytes) }; * let i = str::as_bytes("Hello World") { |bytes| bytes.len() };
* ~~~ * ~~~
*/ */
#[inline] #[inline]

View file

@ -15,8 +15,8 @@ fn vec_equal<T>(v: ~[T],
u: ~[T], u: ~[T],
element_equality_test: @fn(&&T, &&T) -> bool) -> element_equality_test: @fn(&&T, &&T) -> bool) ->
bool { bool {
let Lv = vec::len(v); let Lv = v.len();
if Lv != vec::len(u) { return false; } if Lv != u.len() { return false; }
let i = 0u; let i = 0u;
while i < Lv { while i < Lv {
if !element_equality_test(v[i], u[i]) { return false; } if !element_equality_test(v[i], u[i]) { return false; }

View file

@ -19,7 +19,7 @@ fn under(r : rand::rng, n : uint) -> uint {
// random choice from a vec // random choice from a vec
fn choice<T:copy>(r : rand::rng, v : ~[const T]) -> T { fn choice<T:copy>(r : rand::rng, v : ~[const T]) -> T {
assert!(vec::len(v) != 0u); v[under(r, vec::len(v))] assert!(v.len() != 0u); v[under(r, v.len())]
} }
// k in n chance of being true // k in n chance of being true

View file

@ -18,7 +18,7 @@ fn under(r : rand::rng, n : uint) -> uint {
// random choice from a vec // random choice from a vec
fn choice<T:copy>(r : rand::rng, v : ~[T]) -> T { fn choice<T:copy>(r : rand::rng, v : ~[T]) -> T {
assert!(vec::len(v) != 0u); v[under(r, vec::len(v))] assert!(v.len() != 0u); v[under(r, v.len())]
} }
// 1 in n chance of being true // 1 in n chance of being true
@ -26,7 +26,7 @@ fn unlikely(r : rand::rng, n : uint) -> bool { under(r, n) == 0u }
// shuffle a vec in place // shuffle a vec in place
fn shuffle<T>(r : rand::rng, &v : ~[T]) { fn shuffle<T>(r : rand::rng, &v : ~[T]) {
let i = vec::len(v); let i = v.len();
while i >= 2u { while i >= 2u {
// Loop invariant: elements with index >= i have been locked in place. // Loop invariant: elements with index >= i have been locked in place.
i -= 1u; i -= 1u;
@ -49,7 +49,7 @@ fn shuffled<T:copy>(r : rand::rng, v : ~[T]) -> ~[T] {
// * weighted_vec is O(total weight) space // * weighted_vec is O(total weight) space
type weighted<T> = { weight: uint, item: T }; type weighted<T> = { weight: uint, item: T };
fn weighted_choice<T:copy>(r : rand::rng, v : ~[weighted<T>]) -> T { fn weighted_choice<T:copy>(r : rand::rng, v : ~[weighted<T>]) -> T {
assert!(vec::len(v) != 0u); assert!(v.len() != 0u);
let total = 0u; let total = 0u;
for {weight: weight, item: _} in v { for {weight: weight, item: _} in v {
total += weight; total += weight;

View file

@ -137,8 +137,8 @@ pub fn get_relative_to(abs1: &Path, abs2: &Path) -> Path {
abs1.to_str(), abs2.to_str()); abs1.to_str(), abs2.to_str());
let split1: &[~str] = abs1.components; let split1: &[~str] = abs1.components;
let split2: &[~str] = abs2.components; let split2: &[~str] = abs2.components;
let len1 = vec::len(split1); let len1 = split1.len();
let len2 = vec::len(split2); let len2 = split2.len();
assert!(len1 > 0); assert!(len1 > 0);
assert!(len2 > 0); assert!(len2 > 0);

View file

@ -905,7 +905,6 @@ mod test {
use driver::driver::{build_configuration, build_session}; use driver::driver::{build_configuration, build_session};
use driver::driver::{build_session_options, optgroups, str_input}; use driver::driver::{build_session_options, optgroups, str_input};
use core::vec;
use std::getopts::groups::getopts; use std::getopts::groups::getopts;
use std::getopts; use std::getopts;
use syntax::attr; use syntax::attr;
@ -942,6 +941,6 @@ mod test {
let sess = build_session(sessopts, diagnostic::emit); let sess = build_session(sessopts, diagnostic::emit);
let cfg = build_configuration(sess, @~"whatever", &str_input(~"")); let cfg = build_configuration(sess, @~"whatever", &str_input(~""));
let test_items = attr::find_meta_items_by_name(cfg, ~"test"); let test_items = attr::find_meta_items_by_name(cfg, ~"test");
assert!((vec::len(test_items) == 1u)); assert!(test_items.len() == 1u);
} }
} }

View file

@ -206,7 +206,7 @@ fn is_bench_fn(i: @ast::item) -> bool {
fn has_test_signature(i: @ast::item) -> bool { fn has_test_signature(i: @ast::item) -> bool {
match i.node { match i.node {
ast::item_fn(ref decl, _, _, ref generics, _) => { ast::item_fn(ref decl, _, _, ref generics, _) => {
let input_cnt = vec::len(decl.inputs); let input_cnt = decl.inputs.len();
let no_output = match decl.output.node { let no_output = match decl.output.node {
ast::ty_nil => true, ast::ty_nil => true,
_ => false _ => false

View file

@ -1061,7 +1061,7 @@ fn get_attributes(md: ebml::Doc) -> ~[ast::attribute] {
let meta_items = get_meta_items(attr_doc); let meta_items = get_meta_items(attr_doc);
// Currently it's only possible to have a single meta item on // Currently it's only possible to have a single meta item on
// an attribute // an attribute
assert!((vec::len(meta_items) == 1u)); assert!(meta_items.len() == 1u);
let meta_item = meta_items[0]; let meta_item = meta_items[0];
attrs.push( attrs.push(
codemap::spanned { codemap::spanned {

View file

@ -171,7 +171,7 @@ pub fn metadata_matches(extern_metas: &[@ast::meta_item],
local_metas: &[@ast::meta_item]) -> bool { local_metas: &[@ast::meta_item]) -> bool {
debug!("matching %u metadata requirements against %u items", debug!("matching %u metadata requirements against %u items",
vec::len(local_metas), vec::len(extern_metas)); local_metas.len(), extern_metas.len());
for local_metas.each |needed| { for local_metas.each |needed| {
if !attr::contains(extern_metas, *needed) { if !attr::contains(extern_metas, *needed) {

View file

@ -519,7 +519,7 @@ fn parse_sig(st: @mut PState, conv: conv_did) -> ty::FnSig {
// Rust metadata parsing // Rust metadata parsing
pub fn parse_def_id(buf: &[u8]) -> ast::def_id { pub fn parse_def_id(buf: &[u8]) -> ast::def_id {
let mut colon_idx = 0u; let mut colon_idx = 0u;
let len = vec::len(buf); let len = buf.len();
while colon_idx < len && buf[colon_idx] != ':' as u8 { colon_idx += 1u; } while colon_idx < len && buf[colon_idx] != ':' as u8 { colon_idx += 1u; }
if colon_idx == len { if colon_idx == len {
error!("didn't find ':' when parsing def id"); error!("didn't find ':' when parsing def id");

View file

@ -283,8 +283,8 @@ pub impl RegionMaps {
let a_ancestors = ancestors_of(self, scope_a); let a_ancestors = ancestors_of(self, scope_a);
let b_ancestors = ancestors_of(self, scope_b); let b_ancestors = ancestors_of(self, scope_b);
let mut a_index = vec::len(a_ancestors) - 1u; let mut a_index = a_ancestors.len() - 1u;
let mut b_index = vec::len(b_ancestors) - 1u; let mut b_index = b_ancestors.len() - 1u;
// Here, ~[ab]_ancestors is a vector going from narrow to broad. // Here, ~[ab]_ancestors is a vector going from narrow to broad.
// The end of each vector will be the item where the scope is // The end of each vector will be the item where the scope is

View file

@ -4693,7 +4693,7 @@ pub impl Resolver {
} }
} }
if vec::len(values) > 0 && if values.len() > 0 &&
values[smallest] != uint::max_value && values[smallest] != uint::max_value &&
values[smallest] < str::len(name) + 2 && values[smallest] < str::len(name) + 2 &&
values[smallest] <= max_distance && values[smallest] <= max_distance &&

View file

@ -4720,7 +4720,7 @@ pub impl Resolver {
} }
} }
if vec::len(values) > 0 && if values.len() > 0 &&
values[smallest] != uint::max_value && values[smallest] != uint::max_value &&
values[smallest] < str::len(name) + 2 && values[smallest] < str::len(name) + 2 &&
values[smallest] <= max_distance && values[smallest] <= max_distance &&

View file

@ -65,7 +65,7 @@ pub impl FnType {
let mut llargvals = ~[]; let mut llargvals = ~[];
let mut i = 0u; let mut i = 0u;
let n = vec::len(arg_tys); let n = arg_tys.len();
if self.sret { if self.sret {
let llretptr = GEPi(bcx, llargbundle, [0u, n]); let llretptr = GEPi(bcx, llargbundle, [0u, n]);
@ -113,7 +113,7 @@ pub impl FnType {
if self.sret || !ret_def { if self.sret || !ret_def {
return; return;
} }
let n = vec::len(arg_tys); let n = arg_tys.len();
// R** llretptr = &args->r; // R** llretptr = &args->r;
let llretptr = GEPi(bcx, llargbundle, [0u, n]); let llretptr = GEPi(bcx, llargbundle, [0u, n]);
// R* llretloc = *llretptr; /* (args->r) */ // R* llretloc = *llretptr; /* (args->r) */
@ -149,7 +149,7 @@ pub impl FnType {
}; };
let mut i = 0u; let mut i = 0u;
let n = vec::len(atys); let n = atys.len();
while i < n { while i < n {
let mut argval = get_param(llwrapfn, i + j); let mut argval = get_param(llwrapfn, i + j);
if attrs[i].is_some() { if attrs[i].is_some() {

View file

@ -50,7 +50,7 @@ fn is_sse(c: x86_64_reg_class) -> bool {
} }
fn is_ymm(cls: &[x86_64_reg_class]) -> bool { fn is_ymm(cls: &[x86_64_reg_class]) -> bool {
let len = vec::len(cls); let len = cls.len();
return (len > 2u && return (len > 2u &&
is_sse(cls[0]) && is_sse(cls[0]) &&
cls[1] == sseup_class && cls[1] == sseup_class &&
@ -223,8 +223,8 @@ fn classify_ty(ty: TypeRef) -> ~[x86_64_reg_class] {
unsafe { unsafe {
let mut i = 0u; let mut i = 0u;
let llty = llvm::LLVMGetTypeKind(ty) as int; let llty = llvm::LLVMGetTypeKind(ty) as int;
let e = vec::len(cls); let e = cls.len();
if vec::len(cls) > 2u && if cls.len() > 2u &&
(llty == 10 /* struct */ || (llty == 10 /* struct */ ||
llty == 11 /* array */) { llty == 11 /* array */) {
if is_sse(cls[i]) { if is_sse(cls[i]) {
@ -295,7 +295,7 @@ fn llreg_ty(cls: &[x86_64_reg_class]) -> TypeRef {
unsafe { unsafe {
let mut tys = ~[]; let mut tys = ~[];
let mut i = 0u; let mut i = 0u;
let e = vec::len(cls); let e = cls.len();
while i < e { while i < e {
match cls[i] { match cls[i] {
integer_class => { integer_class => {

View file

@ -509,7 +509,7 @@ pub fn trans_foreign_mod(ccx: @CrateContext,
llargbundle: ValueRef) { llargbundle: ValueRef) {
let _icx = bcx.insn_ctxt("foreign::wrap::build_args"); let _icx = bcx.insn_ctxt("foreign::wrap::build_args");
let ccx = bcx.ccx(); let ccx = bcx.ccx();
let n = vec::len(tys.llsig.llarg_tys); let n = tys.llsig.llarg_tys.len();
let implicit_args = first_real_arg; // return + env let implicit_args = first_real_arg; // return + env
for uint::range(0, n) |i| { for uint::range(0, n) |i| {
let mut llargval = get_param(llwrapfn, i + implicit_args); let mut llargval = get_param(llwrapfn, i + implicit_args);

View file

@ -93,7 +93,7 @@ pub impl Reflector {
let mth_ty = let mth_ty =
ty::mk_bare_fn(tcx, copy self.visitor_methods[mth_idx].fty); ty::mk_bare_fn(tcx, copy self.visitor_methods[mth_idx].fty);
let v = self.visitor_val; let v = self.visitor_val;
debug!("passing %u args:", vec::len(args)); debug!("passing %u args:", args.len());
let bcx = self.bcx; let bcx = self.bcx;
for args.eachi |i, a| { for args.eachi |i, a| {
debug!("arg %u: %s", i, val_str(bcx.ccx().tn, *a)); debug!("arg %u: %s", i, val_str(bcx.ccx().tn, *a));
@ -224,7 +224,7 @@ pub impl Reflector {
let retval = if ty::type_is_bot(fty.sig.output) {0u} else {1u}; let retval = if ty::type_is_bot(fty.sig.output) {0u} else {1u};
let extra = ~[self.c_uint(pureval), let extra = ~[self.c_uint(pureval),
self.c_uint(sigilval), self.c_uint(sigilval),
self.c_uint(vec::len(fty.sig.inputs)), self.c_uint(fty.sig.inputs.len()),
self.c_uint(retval)]; self.c_uint(retval)];
self.visit(~"enter_fn", copy extra); // XXX: Bad copy. self.visit(~"enter_fn", copy extra); // XXX: Bad copy.
self.visit_sig(retval, &fty.sig); self.visit_sig(retval, &fty.sig);
@ -239,7 +239,7 @@ pub impl Reflector {
let retval = if ty::type_is_bot(fty.sig.output) {0u} else {1u}; let retval = if ty::type_is_bot(fty.sig.output) {0u} else {1u};
let extra = ~[self.c_uint(pureval), let extra = ~[self.c_uint(pureval),
self.c_uint(sigilval), self.c_uint(sigilval),
self.c_uint(vec::len(fty.sig.inputs)), self.c_uint(fty.sig.inputs.len()),
self.c_uint(retval)]; self.c_uint(retval)];
self.visit(~"enter_fn", copy extra); // XXX: Bad copy. self.visit(~"enter_fn", copy extra); // XXX: Bad copy.
self.visit_sig(retval, &fty.sig); self.visit_sig(retval, &fty.sig);
@ -309,13 +309,13 @@ pub impl Reflector {
llfdecl llfdecl
}; };
let enum_args = ~[self.c_uint(vec::len(variants)), make_get_disr()] let enum_args = ~[self.c_uint(variants.len()), make_get_disr()]
+ self.c_size_and_align(t); + self.c_size_and_align(t);
do self.bracketed(~"enum", enum_args) |this| { do self.bracketed(~"enum", enum_args) |this| {
for variants.eachi |i, v| { for variants.eachi |i, v| {
let variant_args = ~[this.c_uint(i), let variant_args = ~[this.c_uint(i),
this.c_int(v.disr_val), this.c_int(v.disr_val),
this.c_uint(vec::len(v.args)), this.c_uint(v.args.len()),
this.c_slice(ccx.sess.str_of(v.name))]; this.c_slice(ccx.sess.str_of(v.name))];
do this.bracketed(~"enum_variant", variant_args) |this| { do this.bracketed(~"enum_variant", variant_args) |this| {
for v.args.eachi |j, a| { for v.args.eachi |j, a| {

View file

@ -18,7 +18,6 @@ use middle::trans::common::*;
use middle::trans; use middle::trans;
use core::str; use core::str;
use core::vec;
pub struct Ctxt { pub struct Ctxt {
next_tag_id: u16, next_tag_id: u16,
@ -71,6 +70,6 @@ pub fn add_u16(dest: &mut ~[u8], val: u16) {
} }
pub fn add_substr(dest: &mut ~[u8], src: ~[u8]) { pub fn add_substr(dest: &mut ~[u8], src: ~[u8]) {
add_u16(&mut *dest, vec::len(src) as u16); add_u16(&mut *dest, src.len() as u16);
*dest += src; *dest += src;
} }

View file

@ -2616,7 +2616,7 @@ pub fn deref_sty(cx: ctxt, sty: &sty, explicit: bool) -> Option<mt> {
ty_enum(did, ref substs) => { ty_enum(did, ref substs) => {
let variants = enum_variants(cx, did); let variants = enum_variants(cx, did);
if vec::len(*variants) == 1u && vec::len(variants[0].args) == 1u { if (*variants).len() == 1u && variants[0].args.len() == 1u {
let v_t = subst(cx, substs, variants[0].args[0]); let v_t = subst(cx, substs, variants[0].args[0]);
Some(mt {ty: v_t, mutbl: ast::m_imm}) Some(mt {ty: v_t, mutbl: ast::m_imm})
} else { } else {

View file

@ -3281,7 +3281,7 @@ pub fn instantiate_path(fcx: @mut FnCtxt,
debug!(">>> instantiate_path"); debug!(">>> instantiate_path");
let ty_param_count = tpt.generics.type_param_defs.len(); let ty_param_count = tpt.generics.type_param_defs.len();
let ty_substs_len = vec::len(pth.types); let ty_substs_len = pth.types.len();
debug!("ty_param_count=%? ty_substs_len=%?", debug!("ty_param_count=%? ty_substs_len=%?",
ty_param_count, ty_param_count,

View file

@ -499,15 +499,15 @@ pub fn compare_impl_method(tcx: ty::ctxt,
return; return;
} }
if vec::len(impl_m.fty.sig.inputs) != vec::len(trait_m.fty.sig.inputs) { if impl_m.fty.sig.inputs.len() != trait_m.fty.sig.inputs.len() {
tcx.sess.span_err( tcx.sess.span_err(
cm.span, cm.span,
fmt!("method `%s` has %u parameter%s \ fmt!("method `%s` has %u parameter%s \
but the trait has %u", but the trait has %u",
*tcx.sess.str_of(trait_m.ident), *tcx.sess.str_of(trait_m.ident),
vec::len(impl_m.fty.sig.inputs), impl_m.fty.sig.inputs.len(),
if vec::len(impl_m.fty.sig.inputs) == 1 { "" } else { "s" }, if impl_m.fty.sig.inputs.len() == 1 { "" } else { "s" },
vec::len(trait_m.fty.sig.inputs))); trait_m.fty.sig.inputs.len()));
return; return;
} }

View file

@ -310,7 +310,7 @@ fn check_main_fn_ty(ccx: @mut CrateCtxt,
_ => () _ => ()
} }
let mut ok = ty::type_is_nil(fn_ty.sig.output); let mut ok = ty::type_is_nil(fn_ty.sig.output);
let num_args = vec::len(fn_ty.sig.inputs); let num_args = fn_ty.sig.inputs.len();
ok &= num_args == 0u; ok &= num_args == 0u;
if !ok { if !ok {
tcx.sess.span_err( tcx.sess.span_err(

View file

@ -470,7 +470,7 @@ pub fn parameterized(cx: ctxt,
} }
}; };
if vec::len(tps) > 0u { if tps.len() > 0u {
let strs = vec::map(tps, |t| ty_to_str(cx, *t)); let strs = vec::map(tps, |t| ty_to_str(cx, *t));
fmt!("%s%s<%s>", base, r_str, str::connect(strs, ",")) fmt!("%s%s<%s>", base, r_str, str::connect(strs, ","))
} else { } else {

View file

@ -405,7 +405,7 @@ mod test {
#[test] #[test]
fn should_not_add_impl_trait_types_if_none() { fn should_not_add_impl_trait_types_if_none() {
let doc = mk_doc(~"impl int { fn a() { } }"); let doc = mk_doc(~"impl int { fn a() { } }");
assert!(vec::len(doc.cratemod().impls()[0].trait_types) == 0); assert!(doc.cratemod().impls()[0].trait_types.len() == 0);
} }
#[test] #[test]

View file

@ -628,7 +628,6 @@ pub mod writer {
use core::io; use core::io;
use core::str; use core::str;
use core::vec;
// ebml writing // ebml writing
pub struct Encoder { pub struct Encoder {
@ -707,7 +706,7 @@ pub mod writer {
fn wr_tagged_bytes(&mut self, tag_id: uint, b: &[u8]) { fn wr_tagged_bytes(&mut self, tag_id: uint, b: &[u8]) {
write_vuint(self.writer, tag_id); write_vuint(self.writer, tag_id);
write_vuint(self.writer, vec::len(b)); write_vuint(self.writer, b.len());
self.writer.write(b); self.writer.write(b);
} }
@ -760,7 +759,7 @@ pub mod writer {
} }
fn wr_bytes(&mut self, b: &[u8]) { fn wr_bytes(&mut self, b: &[u8]) {
debug!("Write %u bytes", vec::len(b)); debug!("Write %u bytes", b.len());
self.writer.write(b); self.writer.write(b);
} }

View file

@ -23,7 +23,7 @@ pub fn md4(msg: &[u8]) -> Quad {
// subtle: if orig_len is merely uint, then the code below // subtle: if orig_len is merely uint, then the code below
// which performs shifts by 32 bits or more has undefined // which performs shifts by 32 bits or more has undefined
// results. // results.
let orig_len: u64 = (vec::len(msg) * 8u) as u64; let orig_len: u64 = (msg.len() * 8u) as u64;
// pad message // pad message
let mut msg = vec::append(vec::to_owned(msg), ~[0x80u8]); let mut msg = vec::append(vec::to_owned(msg), ~[0x80u8]);
@ -51,7 +51,7 @@ pub fn md4(msg: &[u8]) -> Quad {
} }
let mut i = 0u; let mut i = 0u;
let e = vec::len(msg); let e = msg.len();
let mut x = vec::from_elem(16u, 0u32); let mut x = vec::from_elem(16u, 0u32);
while i < e { while i < e {
let aa = a, bb = b, cc = c, dd = d; let aa = a, bb = b, cc = c, dd = d;

View file

@ -15,7 +15,6 @@ use core::comm::{stream, SharedChan};
use core::ptr; use core::ptr;
use core::result; use core::result;
use core::str; use core::str;
use core::vec;
use iotask = uv::iotask::IoTask; use iotask = uv::iotask::IoTask;
use interact = uv::iotask::interact; use interact = uv::iotask::interact;
@ -340,7 +339,7 @@ extern fn get_addr_cb(handle: *uv_getaddrinfo_t,
} }
} }
debug!("successful process addrinfo result, len: %?", debug!("successful process addrinfo result, len: %?",
vec::len(out_vec)); out_vec.len());
output_ch.send(result::Ok(out_vec)); output_ch.send(result::Ok(out_vec));
} }
else { else {
@ -424,7 +423,7 @@ mod test {
// this.. mostly just wanting to see it work, atm. // this.. mostly just wanting to see it work, atm.
let results = result::unwrap(ga_result); let results = result::unwrap(ga_result);
debug!("test_get_addr: Number of results for %s: %?", debug!("test_get_addr: Number of results for %s: %?",
localhost_name, vec::len(results)); localhost_name, results.len());
for results.each |r| { for results.each |r| {
let ipv_prefix = match *r { let ipv_prefix = match *r {
Ipv4(_) => ~"IPv4", Ipv4(_) => ~"IPv4",

View file

@ -1802,7 +1802,7 @@ mod test {
debug!("BUF_WRITE: val len %?", str::len(val)); debug!("BUF_WRITE: val len %?", str::len(val));
do str::byte_slice(val) |b_slice| { do str::byte_slice(val) |b_slice| {
debug!("BUF_WRITE: b_slice len %?", debug!("BUF_WRITE: b_slice len %?",
vec::len(b_slice)); b_slice.len());
w.write(b_slice) w.write(b_slice)
} }
} }
@ -1810,7 +1810,7 @@ mod test {
fn buf_read<R:io::Reader>(r: &R, len: uint) -> ~str { fn buf_read<R:io::Reader>(r: &R, len: uint) -> ~str {
let new_bytes = (*r).read_bytes(len); let new_bytes = (*r).read_bytes(len);
debug!("in buf_read.. new_bytes len: %?", debug!("in buf_read.. new_bytes len: %?",
vec::len(new_bytes)); new_bytes.len());
str::from_bytes(new_bytes) str::from_bytes(new_bytes)
} }
@ -1863,7 +1863,7 @@ mod test {
result::Ok(data) => { result::Ok(data) => {
debug!("SERVER: got REQ str::from_bytes.."); debug!("SERVER: got REQ str::from_bytes..");
debug!("SERVER: REQ data len: %?", debug!("SERVER: REQ data len: %?",
vec::len(data)); data.len());
server_ch.send( server_ch.send(
str::from_bytes(data)); str::from_bytes(data));
debug!("SERVER: before write"); debug!("SERVER: before write");

View file

@ -58,9 +58,8 @@ fn map_slices<A:Copy + Owned,B:Copy + Owned>(
info!("pre-slice: %?", (base, slice)); info!("pre-slice: %?", (base, slice));
let slice : &[A] = let slice : &[A] =
cast::transmute(slice); cast::transmute(slice);
info!("slice: %?", info!("slice: %?", (base, slice.len(), end - base));
(base, vec::len(slice), end - base)); assert!(slice.len() == end - base);
assert!((vec::len(slice) == end - base));
f(base, slice) f(base, slice)
} }
}; };

View file

@ -164,7 +164,7 @@ pub fn append_rope(left: Rope, right: Rope) -> Rope {
*/ */
pub fn concat(v: ~[Rope]) -> Rope { pub fn concat(v: ~[Rope]) -> Rope {
//Copy `v` into a mut vector //Copy `v` into a mut vector
let mut len = vec::len(v); let mut len = v.len();
if len == 0u { return node::Empty; } if len == 0u { return node::Empty; }
let mut ropes = vec::from_elem(len, v[0]); let mut ropes = vec::from_elem(len, v[0]);
for uint::range(1u, len) |i| { for uint::range(1u, len) |i| {
@ -770,7 +770,7 @@ pub mod node {
*/ */
pub fn tree_from_forest_destructive(forest: &mut [@Node]) -> @Node { pub fn tree_from_forest_destructive(forest: &mut [@Node]) -> @Node {
let mut i; let mut i;
let mut len = vec::len(forest); let mut len = forest.len();
while len > 1u { while len > 1u {
i = 0u; i = 0u;
while i < len - 1u {//Concat nodes 0 with 1, 2 with 3 etc. while i < len - 1u {//Concat nodes 0 with 1, 2 with 3 etc.

View file

@ -90,8 +90,8 @@ pub fn sha1() -> @Sha1 {
} }
} }
fn process_msg_block(st: &mut Sha1State) { fn process_msg_block(st: &mut Sha1State) {
assert!((vec::len(st.h) == digest_buf_len)); assert!(st.h.len() == digest_buf_len);
assert!((vec::uniq_len(st.work_buf) == work_buf_len)); assert!(vec::uniq_len(st.work_buf) == work_buf_len);
let mut t: int; // Loop counter let mut t: int; // Loop counter
let w = st.work_buf; let w = st.work_buf;
@ -230,7 +230,7 @@ pub fn sha1() -> @Sha1 {
impl Sha1 for Sha1State { impl Sha1 for Sha1State {
fn reset(&mut self) { fn reset(&mut self) {
assert!((vec::len(self.h) == digest_buf_len)); assert!(self.h.len() == digest_buf_len);
self.len_low = 0u32; self.len_low = 0u32;
self.len_high = 0u32; self.len_high = 0u32;
self.msg_block_idx = 0u; self.msg_block_idx = 0u;

View file

@ -19,7 +19,6 @@ use core::unstable::sync::{Exclusive, exclusive};
use core::ptr; use core::ptr;
use core::task; use core::task;
use core::util; use core::util;
use core::vec;
/**************************************************************************** /****************************************************************************
* Internals * Internals
@ -220,7 +219,7 @@ pub impl<'self> Condvar<'self> {
do task::unkillable { do task::unkillable {
// Release lock, 'atomically' enqueuing ourselves in so doing. // Release lock, 'atomically' enqueuing ourselves in so doing.
do (**self.sem).with |state| { do (**self.sem).with |state| {
if condvar_id < vec::len(state.blocked) { if condvar_id < state.blocked.len() {
// Drop the lock. // Drop the lock.
state.count += 1; state.count += 1;
if state.count <= 0 { if state.count <= 0 {
@ -230,7 +229,7 @@ pub impl<'self> Condvar<'self> {
let SignalEnd = SignalEnd.swap_unwrap(); let SignalEnd = SignalEnd.swap_unwrap();
state.blocked[condvar_id].tail.send(SignalEnd); state.blocked[condvar_id].tail.send(SignalEnd);
} else { } else {
out_of_bounds = Some(vec::len(state.blocked)); out_of_bounds = Some(state.blocked.len());
} }
} }
@ -285,10 +284,10 @@ pub impl<'self> Condvar<'self> {
let mut out_of_bounds = None; let mut out_of_bounds = None;
let mut result = false; let mut result = false;
do (**self.sem).with |state| { do (**self.sem).with |state| {
if condvar_id < vec::len(state.blocked) { if condvar_id < state.blocked.len() {
result = signal_waitqueue(&state.blocked[condvar_id]); result = signal_waitqueue(&state.blocked[condvar_id]);
} else { } else {
out_of_bounds = Some(vec::len(state.blocked)); out_of_bounds = Some(state.blocked.len());
} }
} }
do check_cvar_bounds(out_of_bounds, condvar_id, "cond.signal_on()") { do check_cvar_bounds(out_of_bounds, condvar_id, "cond.signal_on()") {
@ -304,14 +303,14 @@ pub impl<'self> Condvar<'self> {
let mut out_of_bounds = None; let mut out_of_bounds = None;
let mut queue = None; let mut queue = None;
do (**self.sem).with |state| { do (**self.sem).with |state| {
if condvar_id < vec::len(state.blocked) { if condvar_id < state.blocked.len() {
// To avoid :broadcast_heavy, we make a new waitqueue, // To avoid :broadcast_heavy, we make a new waitqueue,
// swap it out with the old one, and broadcast on the // swap it out with the old one, and broadcast on the
// old one outside of the little-lock. // old one outside of the little-lock.
queue = Some(util::replace(&mut state.blocked[condvar_id], queue = Some(util::replace(&mut state.blocked[condvar_id],
new_waitqueue())); new_waitqueue()));
} else { } else {
out_of_bounds = Some(vec::len(state.blocked)); out_of_bounds = Some(state.blocked.len());
} }
} }
do check_cvar_bounds(out_of_bounds, condvar_id, "cond.signal_on()") { do check_cvar_bounds(out_of_bounds, condvar_id, "cond.signal_on()") {

View file

@ -144,7 +144,7 @@ pub fn parse_opts(args: &[~str]) -> OptRes {
}; };
let filter = let filter =
if vec::len(matches.free) > 0 { if matches.free.len() > 0 {
option::Some(copy (matches).free[0]) option::Some(copy (matches).free[0])
} else { option::None }; } else { option::None };
@ -901,7 +901,7 @@ mod tests {
]; ];
let filtered = filter_tests(&opts, tests); let filtered = filter_tests(&opts, tests);
assert!((vec::len(filtered) == 1)); assert!(filtered.len() == 1);
assert!((filtered[0].desc.name.to_str() == ~"1")); assert!((filtered[0].desc.name.to_str() == ~"1"));
assert!((filtered[0].desc.ignore == false)); assert!((filtered[0].desc.ignore == false));
} }

View file

@ -1358,7 +1358,7 @@ mod test {
let req_msg_ptr: *u8 = vec::raw::to_ptr(req_str_bytes); let req_msg_ptr: *u8 = vec::raw::to_ptr(req_str_bytes);
debug!("req_msg ptr: %u", req_msg_ptr as uint); debug!("req_msg ptr: %u", req_msg_ptr as uint);
let req_msg = ~[ let req_msg = ~[
buf_init(req_msg_ptr, vec::len(req_str_bytes)) buf_init(req_msg_ptr, req_str_bytes.len())
]; ];
// this is the enclosing record, we'll pass a ptr to // this is the enclosing record, we'll pass a ptr to
// this to C.. // this to C..

View file

@ -232,7 +232,7 @@ fn highlight_lines(cm: @codemap::CodeMap,
let max_lines = 6u; let max_lines = 6u;
let mut elided = false; let mut elided = false;
let mut display_lines = /* FIXME (#2543) */ copy lines.lines; let mut display_lines = /* FIXME (#2543) */ copy lines.lines;
if vec::len(display_lines) > max_lines { if display_lines.len() > max_lines {
display_lines = vec::slice(display_lines, 0u, max_lines).to_vec(); display_lines = vec::slice(display_lines, 0u, max_lines).to_vec();
elided = true; elided = true;
} }
@ -243,7 +243,7 @@ fn highlight_lines(cm: @codemap::CodeMap,
io::stderr().write_str(s); io::stderr().write_str(s);
} }
if elided { if elided {
let last_line = display_lines[vec::len(display_lines) - 1u]; let last_line = display_lines[display_lines.len() - 1u];
let s = fmt!("%s:%u ", fm.name, last_line + 1u); let s = fmt!("%s:%u ", fm.name, last_line + 1u);
let mut indent = str::len(s); let mut indent = str::len(s);
let mut out = ~""; let mut out = ~"";
@ -254,7 +254,7 @@ fn highlight_lines(cm: @codemap::CodeMap,
// FIXME (#3260) // FIXME (#3260)
// If there's one line at fault we can easily point to the problem // If there's one line at fault we can easily point to the problem
if vec::len(lines.lines) == 1u { if lines.lines.len() == 1u {
let lo = cm.lookup_char_pos(sp.lo); let lo = cm.lookup_char_pos(sp.lo);
let mut digits = 0u; let mut digits = 0u;
let mut num = (lines.lines[0] + 1u) / 10u; let mut num = (lines.lines[0] + 1u) / 10u;

View file

@ -824,7 +824,7 @@ fn mk_struct_ser_impl(
cx.ident_of("emit_struct"), cx.ident_of("emit_struct"),
~[ ~[
cx.lit_str(span, @cx.str_of(ident)), cx.lit_str(span, @cx.str_of(ident)),
cx.lit_uint(span, vec::len(fields)), cx.lit_uint(span, fields.len()),
cx.lambda_stmts_1(span, fields, cx.ident_of("__s")), cx.lambda_stmts_1(span, fields, cx.ident_of("__s")),
] ]
); );
@ -886,7 +886,7 @@ fn mk_struct_deser_impl(
cx.ident_of("read_struct"), cx.ident_of("read_struct"),
~[ ~[
cx.lit_str(span, @cx.str_of(ident)), cx.lit_str(span, @cx.str_of(ident)),
cx.lit_uint(span, vec::len(fields)), cx.lit_uint(span, fields.len()),
cx.lambda_expr_1( cx.lambda_expr_1(
cx.expr( cx.expr(
span, span,

View file

@ -351,7 +351,7 @@ pub fn expr_to_ident(cx: @ext_ctxt,
err_msg: &str) -> ast::ident { err_msg: &str) -> ast::ident {
match expr.node { match expr.node {
ast::expr_path(p) => { ast::expr_path(p) => {
if vec::len(p.types) > 0u || vec::len(p.idents) != 1u { if p.types.len() > 0u || p.idents.len() != 1u {
cx.span_fatal(expr.span, err_msg); cx.span_fatal(expr.span, err_msg);
} }
return p.idents[0]; return p.idents[0];

View file

@ -276,7 +276,7 @@ fn read_block_comment(rdr: @mut StringReader,
let mut style = if code_to_the_left { trailing } else { isolated }; let mut style = if code_to_the_left { trailing } else { isolated };
consume_non_eol_whitespace(rdr); consume_non_eol_whitespace(rdr);
if !is_eof(rdr) && rdr.curr != '\n' && vec::len(lines) == 1u { if !is_eof(rdr) && rdr.curr != '\n' && lines.len() == 1u {
style = mixed; style = mixed;
} }
debug!("<<< block comment"); debug!("<<< block comment");

View file

@ -2471,7 +2471,7 @@ pub impl Parser {
} }
}, },
_ => { _ => {
if vec::len(enum_path.idents)==1u { if enum_path.idents.len()==1u {
// it could still be either an enum // it could still be either an enum
// or an identifier pattern, resolve // or an identifier pattern, resolve
// will sort it out: // will sort it out:
@ -4337,7 +4337,7 @@ pub impl Parser {
} }
_ => () _ => ()
} }
let last = path[vec::len(path) - 1u]; let last = path[path.len() - 1u];
let path = @ast::Path { span: mk_sp(lo, self.span.hi), let path = @ast::Path { span: mk_sp(lo, self.span.hi),
global: false, global: false,
idents: path, idents: path,

View file

@ -110,8 +110,8 @@ pub fn tok_str(t: token) -> ~str {
pub fn buf_str(toks: ~[token], szs: ~[int], left: uint, right: uint, pub fn buf_str(toks: ~[token], szs: ~[int], left: uint, right: uint,
lim: uint) -> ~str { lim: uint) -> ~str {
let n = vec::len(toks); let n = toks.len();
assert!(n == vec::len(szs)); assert!(n == szs.len());
let mut i = left; let mut i = left;
let mut L = lim; let mut L = lim;
let mut s = ~"["; let mut s = ~"[";

View file

@ -1798,7 +1798,7 @@ pub fn print_meta_item(s: @ps, item: @ast::meta_item) {
pub fn print_view_path(s: @ps, vp: @ast::view_path) { pub fn print_view_path(s: @ps, vp: @ast::view_path) {
match vp.node { match vp.node {
ast::view_path_simple(ident, path, _) => { ast::view_path_simple(ident, path, _) => {
if path.idents[vec::len(path.idents)-1u] != ident { if path.idents[path.idents.len()-1u] != ident {
print_ident(s, ident); print_ident(s, ident);
space(s.s); space(s.s);
word_space(s, ~"="); word_space(s, ~"=");
@ -2067,7 +2067,7 @@ pub fn maybe_print_comment(s: @ps, pos: BytePos) {
pub fn print_comment(s: @ps, cmnt: &comments::cmnt) { pub fn print_comment(s: @ps, cmnt: &comments::cmnt) {
match cmnt.style { match cmnt.style {
comments::mixed => { comments::mixed => {
assert!((vec::len(cmnt.lines) == 1u)); assert!(cmnt.lines.len() == 1u);
zerobreak(s.s); zerobreak(s.s);
word(s.s, cmnt.lines[0]); word(s.s, cmnt.lines[0]);
zerobreak(s.s); zerobreak(s.s);
@ -2083,7 +2083,7 @@ pub fn print_comment(s: @ps, cmnt: &comments::cmnt) {
} }
comments::trailing => { comments::trailing => {
word(s.s, ~" "); word(s.s, ~" ");
if vec::len(cmnt.lines) == 1u { if cmnt.lines.len() == 1u {
word(s.s, cmnt.lines[0]); word(s.s, cmnt.lines[0]);
hardbreak(s.s); hardbreak(s.s);
} else { } else {

View file

@ -13,7 +13,7 @@
#[inline] #[inline]
pub fn iter<T>(v: &[T], f: &fn(&T)) { pub fn iter<T>(v: &[T], f: &fn(&T)) {
let mut i = 0u; let mut i = 0u;
let n = vec::len(v); let n = v.len();
while i < n { while i < n {
f(&v[i]); f(&v[i]);
i += 1u; i += 1u;

View file

@ -13,7 +13,7 @@
// same as cci_iter_lib, more-or-less, but not marked inline // same as cci_iter_lib, more-or-less, but not marked inline
pub fn iter(v: ~[uint], f: &fn(uint)) { pub fn iter(v: ~[uint], f: &fn(uint)) {
let mut i = 0u; let mut i = 0u;
let n = vec::len(v); let n = v.len();
while i < n { while i < n {
f(v[i]); f(v[i]);
i += 1u; i += 1u;

View file

@ -126,7 +126,7 @@ fn gen_search_keys(graph: &[~[node_id]], n: uint) -> ~[node_id] {
*/ */
fn bfs(graph: graph, key: node_id) -> bfs_result { fn bfs(graph: graph, key: node_id) -> bfs_result {
let mut marks : ~[node_id] let mut marks : ~[node_id]
= vec::from_elem(vec::len(graph), -1i64); = vec::from_elem(graph.len(), -1i64);
let mut q = Deque::new(); let mut q = Deque::new();
@ -429,7 +429,7 @@ fn main() {
let stop = time::precise_time_s(); let stop = time::precise_time_s();
io::stdout().write_line(fmt!("Generated %? edges in %? seconds.", io::stdout().write_line(fmt!("Generated %? edges in %? seconds.",
vec::len(edges), stop - start)); edges.len(), stop - start));
let start = time::precise_time_s(); let start = time::precise_time_s();
let graph = make_graph(1 << scale, copy edges); let graph = make_graph(1 << scale, copy edges);

View file

@ -95,7 +95,7 @@ fn windows_with_carry(bb: &[u8], nn: uint,
it: &fn(window: &[u8])) -> ~[u8] { it: &fn(window: &[u8])) -> ~[u8] {
let mut ii = 0u; let mut ii = 0u;
let len = vec::len(bb); let len = bb.len();
while ii < len - (nn - 1u) { while ii < len - (nn - 1u) {
it(vec::slice(bb, ii, ii+nn)); it(vec::slice(bb, ii, ii+nn));
ii += 1u; ii += 1u;

View file

@ -70,7 +70,7 @@ pub impl Sudoku {
let line = reader.read_line(); let line = reader.read_line();
let mut comps = ~[]; let mut comps = ~[];
for str::each_split_char(line.trim(), ',') |s| { comps.push(s.to_owned()) } for str::each_split_char(line.trim(), ',') |s| { comps.push(s.to_owned()) }
if vec::len(comps) == 3u { if comps.len() == 3u {
let row = uint::from_str(comps[0]).get() as u8; let row = uint::from_str(comps[0]).get() as u8;
let col = uint::from_str(comps[1]).get() as u8; let col = uint::from_str(comps[1]).get() as u8;
g[row][col] = uint::from_str(comps[2]).get() as u8; g[row][col] = uint::from_str(comps[2]).get() as u8;
@ -103,7 +103,7 @@ pub impl Sudoku {
} }
let mut ptr = 0u; let mut ptr = 0u;
let end = vec::len(work); let end = work.len();
while (ptr < end) { while (ptr < end) {
let (row, col) = work[ptr]; let (row, col) = work[ptr];
// is there another color to try? // is there another color to try?
@ -265,7 +265,7 @@ fn check_default_sudoku_solution() {
fn main() { fn main() {
let args = os::args(); let args = os::args();
let use_default = vec::len(args) == 1u; let use_default = args.len() == 1u;
let mut sudoku = if use_default { let mut sudoku = if use_default {
Sudoku::from_vec(&default_sudoku) Sudoku::from_vec(&default_sudoku)
} else { } else {

View file

@ -39,15 +39,15 @@ pub fn main() {
// Call a method // Call a method
for x.iterate() |y| { assert!(x[*y] == *y); } for x.iterate() |y| { assert!(x[*y] == *y); }
// Call a parameterized function // Call a parameterized function
assert!(length(x.clone()) == vec::len(x)); assert!(length(x.clone()) == x.len());
// Call a parameterized function, with type arguments that require // Call a parameterized function, with type arguments that require
// a borrow // a borrow
assert!(length::<int, &[int]>(x) == vec::len(x)); assert!(length::<int, &[int]>(x) == x.len());
// Now try it with a type that *needs* to be borrowed // Now try it with a type that *needs* to be borrowed
let z = [0,1,2,3]; let z = [0,1,2,3];
// Call a method // Call a method
for z.iterate() |y| { assert!(z[*y] == *y); } for z.iterate() |y| { assert!(z[*y] == *y); }
// Call a parameterized function // Call a parameterized function
assert!(length::<int, &[int]>(z) == vec::len(z)); assert!(length::<int, &[int]>(z) == z.len());
} }

View file

@ -103,7 +103,7 @@ fn annoy_neighbors<T:noisy>(critter: T) {
fn bite_everything<T:bitey>(critter: T) -> bool { fn bite_everything<T:bitey>(critter: T) -> bool {
let mut left : ~[body_part] = ~[finger, toe, nose, ear]; let mut left : ~[body_part] = ~[finger, toe, nose, ear];
while vec::len(left) > 0u { while left.len() > 0u {
let part = critter.bite(); let part = critter.bite();
debug!("%? %?", left, part); debug!("%? %?", left, part);
if vec_includes(left, part) { if vec_includes(left, part) {

View file

@ -71,7 +71,7 @@ mod map_reduce {
start_mappers(ctrl_chan, inputs.clone()); start_mappers(ctrl_chan, inputs.clone());
let mut num_mappers = vec::len(inputs) as int; let mut num_mappers = inputs.len() as int;
while num_mappers > 0 { while num_mappers > 0 {
match ctrl_port.recv() { match ctrl_port.recv() {

View file

@ -14,7 +14,7 @@ fn test_heap_to_heap() {
// a spills onto the heap // a spills onto the heap
let mut a = ~[0, 1, 2, 3, 4]; let mut a = ~[0, 1, 2, 3, 4];
a = a + a; // FIXME(#3387)---can't write a += a a = a + a; // FIXME(#3387)---can't write a += a
assert!((vec::len(a) == 10u)); assert!(a.len() == 10u);
assert!((a[0] == 0)); assert!((a[0] == 0));
assert!((a[1] == 1)); assert!((a[1] == 1));
assert!((a[2] == 2)); assert!((a[2] == 2));
@ -32,7 +32,7 @@ fn test_stack_to_heap() {
let mut a = ~[0, 1, 2]; let mut a = ~[0, 1, 2];
// a spills to the heap // a spills to the heap
a = a + a; // FIXME(#3387)---can't write a += a a = a + a; // FIXME(#3387)---can't write a += a
assert!((vec::len(a) == 6u)); assert!(a.len() == 6u);
assert!((a[0] == 0)); assert!((a[0] == 0));
assert!((a[1] == 1)); assert!((a[1] == 1));
assert!((a[2] == 2)); assert!((a[2] == 2));
@ -47,8 +47,8 @@ fn test_loop() {
let mut i = 20; let mut i = 20;
let mut expected_len = 1u; let mut expected_len = 1u;
while i > 0 { while i > 0 {
error!(vec::len(a)); error!(a.len());
assert!((vec::len(a) == expected_len)); assert!(a.len() == expected_len);
a = a + a; // FIXME(#3387)---can't write a += a a = a + a; // FIXME(#3387)---can't write a += a
i -= 1; i -= 1;
expected_len *= 2u; expected_len *= 2u;