auto merge of #6328 : recrack/rust/rename_cleanup, r=sanxiyn
rename vec::each(var) to var.each > librustc, libsyntax, libstd, librustdoc, libcore
This commit is contained in:
commit
936c07dcf0
@ -102,7 +102,7 @@ pub fn build_sized_opt<A>(size: Option<uint>,
|
||||
#[inline(always)]
|
||||
pub fn append<T:Copy>(lhs: @[T], rhs: &const [T]) -> @[T] {
|
||||
do build_sized(lhs.len() + rhs.len()) |push| {
|
||||
for vec::each(lhs) |x| { push(*x); }
|
||||
for lhs.each |x| { push(*x); }
|
||||
for uint::range(0, rhs.len()) |i| { push(rhs[i]); }
|
||||
}
|
||||
}
|
||||
@ -111,7 +111,7 @@ pub fn append<T:Copy>(lhs: @[T], rhs: &const [T]) -> @[T] {
|
||||
/// Apply a function to each element of a vector and return the results
|
||||
pub fn map<T, U>(v: &[T], f: &fn(x: &T) -> U) -> @[U] {
|
||||
do build_sized(v.len()) |push| {
|
||||
for vec::each(v) |elem| {
|
||||
for v.each |elem| {
|
||||
push(f(elem));
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ pub fn lefts<T:Copy,U>(eithers: &[Either<T, U>]) -> ~[T] {
|
||||
//! Extracts from a vector of either all the left values
|
||||
|
||||
do vec::build_sized(eithers.len()) |push| {
|
||||
for vec::each(eithers) |elt| {
|
||||
for eithers.each |elt| {
|
||||
match *elt {
|
||||
Left(ref l) => { push(*l); }
|
||||
_ => { /* fallthrough */ }
|
||||
@ -57,7 +57,7 @@ pub fn rights<T, U: Copy>(eithers: &[Either<T, U>]) -> ~[U] {
|
||||
//! Extracts from a vector of either all the right values
|
||||
|
||||
do vec::build_sized(eithers.len()) |push| {
|
||||
for vec::each(eithers) |elt| {
|
||||
for eithers.each |elt| {
|
||||
match *elt {
|
||||
Right(ref r) => { push(*r); }
|
||||
_ => { /* fallthrough */ }
|
||||
|
@ -24,7 +24,6 @@ use cast;
|
||||
use rt::io::Writer;
|
||||
use to_bytes::IterBytes;
|
||||
use uint;
|
||||
use vec;
|
||||
|
||||
// Alias `SipState` to `State`.
|
||||
pub use State = hash::SipState;
|
||||
@ -378,7 +377,7 @@ impl Streaming for SipState {
|
||||
fn result_str(&mut self) -> ~str {
|
||||
let r = self.result_bytes();
|
||||
let mut s = ~"";
|
||||
for vec::each(r) |b| {
|
||||
for r.each |b| {
|
||||
s += uint::to_str_radix(*b as uint, 16u);
|
||||
}
|
||||
s
|
||||
@ -478,7 +477,7 @@ mod tests {
|
||||
|
||||
fn to_hex_str(r: &[u8, ..8]) -> ~str {
|
||||
let mut s = ~"";
|
||||
for vec::each(*r) |b| {
|
||||
for (*r).each |b| {
|
||||
s += uint::to_str_radix(*b as uint, 16u);
|
||||
}
|
||||
s
|
||||
|
@ -1200,7 +1200,7 @@ pub fn mk_file_writer(path: &Path, flags: &[FileFlag])
|
||||
fn wb() -> c_int { O_WRONLY as c_int }
|
||||
|
||||
let mut fflags: c_int = wb();
|
||||
for vec::each(flags) |f| {
|
||||
for flags.each |f| {
|
||||
match *f {
|
||||
Append => fflags |= O_APPEND as c_int,
|
||||
Create => fflags |= O_CREAT as c_int,
|
||||
|
@ -1491,7 +1491,7 @@ mod tests {
|
||||
fn test_env_getenv() {
|
||||
let e = env();
|
||||
assert!(vec::len(e) > 0u);
|
||||
for vec::each(e) |p| {
|
||||
for e.each |p| {
|
||||
let (n, v) = copy *p;
|
||||
debug!(copy n);
|
||||
let v2 = getenv(n);
|
||||
@ -1583,7 +1583,7 @@ mod tests {
|
||||
// Just assuming that we've got some contents in the current directory
|
||||
assert!((vec::len(dirs) > 0u));
|
||||
|
||||
for vec::each(dirs) |dir| {
|
||||
for dirs.each |dir| {
|
||||
debug!(copy *dir);
|
||||
}
|
||||
}
|
||||
|
@ -300,7 +300,7 @@ pub fn map_vec<T,U:Copy,V:Copy>(
|
||||
ts: &[T], op: &fn(&T) -> Result<V,U>) -> Result<~[V],U> {
|
||||
|
||||
let mut vs: ~[V] = vec::with_capacity(vec::len(ts));
|
||||
for vec::each(ts) |t| {
|
||||
for ts.each |t| {
|
||||
match op(t) {
|
||||
Ok(copy v) => vs.push(v),
|
||||
Err(copy u) => return Err(u)
|
||||
|
@ -426,7 +426,7 @@ fn with_argv<T>(prog: &str, args: &[~str],
|
||||
cb: &fn(**libc::c_char) -> T) -> T {
|
||||
let mut argptrs = str::as_c_str(prog, |b| ~[b]);
|
||||
let mut tmps = ~[];
|
||||
for vec::each(args) |arg| {
|
||||
for args.each |arg| {
|
||||
let t = @copy *arg;
|
||||
tmps.push(t);
|
||||
argptrs.push_all(str::as_c_str(*t, |b| ~[b]));
|
||||
@ -445,7 +445,7 @@ fn with_envp<T>(env: &Option<~[(~str,~str)]>,
|
||||
let mut tmps = ~[];
|
||||
let mut ptrs = ~[];
|
||||
|
||||
for vec::each(*es) |e| {
|
||||
for (*es).each |e| {
|
||||
let (k,v) = copy *e;
|
||||
let t = @(fmt!("%s=%s", k, v));
|
||||
tmps.push(t);
|
||||
@ -470,7 +470,7 @@ fn with_envp<T>(env: &Option<~[(~str,~str)]>,
|
||||
match *env {
|
||||
Some(ref es) if !vec::is_empty(*es) => {
|
||||
let mut blk : ~[u8] = ~[];
|
||||
for vec::each(*es) |e| {
|
||||
for (*es).each |e| {
|
||||
let (k,v) = copy *e;
|
||||
let t = fmt!("%s=%s", k, v);
|
||||
let mut v : ~[u8] = ::cast::transmute(t);
|
||||
|
@ -189,7 +189,7 @@ pub fn from_char(ch: char) -> ~str {
|
||||
pub fn from_chars(chs: &[char]) -> ~str {
|
||||
let mut buf = ~"";
|
||||
reserve(&mut buf, chs.len());
|
||||
for vec::each(chs) |ch| {
|
||||
for chs.each |ch| {
|
||||
push_char(&mut buf, *ch);
|
||||
}
|
||||
buf
|
||||
@ -326,7 +326,7 @@ pub fn connect_slices(v: &[&str], sep: &str) -> ~str {
|
||||
do as_buf(sep) |sepbuf, seplen| {
|
||||
let seplen = seplen - 1;
|
||||
let mut buf = ::cast::transmute_mut_unsafe(buf);
|
||||
for vec::each(v) |ss| {
|
||||
for v.each |ss| {
|
||||
do as_buf(*ss) |ssbuf, sslen| {
|
||||
let sslen = sslen - 1;
|
||||
if first {
|
||||
@ -2407,7 +2407,7 @@ pub mod raw {
|
||||
unsafe fn push_bytes(s: &mut ~str, bytes: &[u8]) {
|
||||
let new_len = s.len() + bytes.len();
|
||||
reserve_at_least(&mut *s, new_len);
|
||||
for vec::each(bytes) |byte| { push_byte(&mut *s, *byte); }
|
||||
for bytes.each |byte| { push_byte(&mut *s, *byte); }
|
||||
}
|
||||
|
||||
/// Removes the last byte from a string and returns it. (Not UTF-8 safe).
|
||||
@ -3782,7 +3782,7 @@ mod tests {
|
||||
0xd801_u16, 0xdc95_u16, 0xd801_u16, 0xdc86_u16,
|
||||
0x000a_u16 ]) ];
|
||||
|
||||
for vec::each(pairs) |p| {
|
||||
for pairs.each |p| {
|
||||
let (s, u) = copy *p;
|
||||
assert!(to_utf16(s) == u);
|
||||
assert!(from_utf16(u) == s);
|
||||
|
@ -1084,7 +1084,7 @@ fn encode_index<T>(ebml_w: &mut writer::Encoder,
|
||||
for buckets.each |bucket| {
|
||||
bucket_locs.push(ebml_w.writer.tell());
|
||||
ebml_w.start_tag(tag_index_buckets_bucket);
|
||||
for vec::each(**bucket) |elt| {
|
||||
for (**bucket).each |elt| {
|
||||
ebml_w.start_tag(tag_index_buckets_bucket_elt);
|
||||
assert!(elt.pos < 0xffff_ffff);
|
||||
writer.write_be_u32(elt.pos as u32);
|
||||
|
@ -17,7 +17,6 @@ use core::hashmap::HashMap;
|
||||
use core::io::WriterUtil;
|
||||
use core::io;
|
||||
use core::uint;
|
||||
use core::vec;
|
||||
use syntax::abi::AbiSet;
|
||||
use syntax::ast;
|
||||
use syntax::ast::*;
|
||||
@ -398,7 +397,7 @@ fn enc_fn_sig(w: @io::Writer, cx: @ctxt, fsig: &ty::FnSig) {
|
||||
}
|
||||
|
||||
fn enc_bounds(w: @io::Writer, cx: @ctxt, bs: @~[ty::param_bound]) {
|
||||
for vec::each(*bs) |bound| {
|
||||
for (*bs).each |bound| {
|
||||
match *bound {
|
||||
ty::bound_owned => w.write_char('S'),
|
||||
ty::bound_copy => w.write_char('C'),
|
||||
|
@ -366,7 +366,7 @@ pub fn missing_ctor(cx: @MatchCheckCtxt,
|
||||
}
|
||||
let variants = ty::enum_variants(cx.tcx, eid);
|
||||
if found.len() != (*variants).len() {
|
||||
for vec::each(*variants) |v| {
|
||||
for (*variants).each |v| {
|
||||
if !found.contains(&(variant(v.id))) {
|
||||
return Some(variant(v.id));
|
||||
}
|
||||
|
@ -235,7 +235,7 @@ fn check_fn(
|
||||
}
|
||||
|
||||
fn check_arm(a: &arm, cx: Context, v: visit::vt<Context>) {
|
||||
for vec::each(a.pats) |p| {
|
||||
for a.pats.each |p| {
|
||||
do pat_util::pat_bindings(cx.tcx.def_map, *p) |mode, id, span, _pth| {
|
||||
if mode == bind_by_copy {
|
||||
let t = ty::node_id_to_type(cx.tcx, id);
|
||||
|
@ -4630,7 +4630,7 @@ pub impl Resolver {
|
||||
}
|
||||
|
||||
let mut smallest = 0;
|
||||
for vec::eachi(maybes) |i, &other| {
|
||||
for maybes.eachi |i, &other| {
|
||||
|
||||
values[i] = str::levdistance(name, other);
|
||||
|
||||
@ -4664,7 +4664,7 @@ pub impl Resolver {
|
||||
if item.id == node_id {
|
||||
match item.node {
|
||||
item_struct(class_def, _) => {
|
||||
for vec::each(class_def.fields) |field| {
|
||||
for class_def.fields.each |field| {
|
||||
match field.node.kind {
|
||||
unnamed_field => {},
|
||||
named_field(ident, _) => {
|
||||
|
@ -4681,7 +4681,7 @@ pub impl Resolver {
|
||||
}
|
||||
|
||||
let mut smallest = 0;
|
||||
for vec::eachi(maybes) |i, &other| {
|
||||
for maybes.eachi |i, &other| {
|
||||
|
||||
values[i] = str::levdistance(name, other);
|
||||
|
||||
@ -4715,7 +4715,7 @@ pub impl Resolver {
|
||||
if item.id == node_id {
|
||||
match item.node {
|
||||
item_struct(class_def, _) => {
|
||||
for vec::each(class_def.fields) |field| {
|
||||
for class_def.fields.each |field| {
|
||||
match field.node.kind {
|
||||
unnamed_field => {},
|
||||
named_field(ident, _) => {
|
||||
|
@ -283,7 +283,7 @@ pub fn variant_opt(bcx: block, pat_id: ast::node_id)
|
||||
match ccx.tcx.def_map.get_copy(&pat_id) {
|
||||
ast::def_variant(enum_id, var_id) => {
|
||||
let variants = ty::enum_variants(ccx.tcx, enum_id);
|
||||
for vec::each(*variants) |v| {
|
||||
for (*variants).each |v| {
|
||||
if var_id == v.id {
|
||||
return var(v.disr_val,
|
||||
adt::represent_node(bcx, pat_id))
|
||||
@ -349,7 +349,7 @@ pub fn matches_to_str(bcx: block, m: &[@Match]) -> ~str {
|
||||
}
|
||||
|
||||
pub fn has_nested_bindings(m: &[@Match], col: uint) -> bool {
|
||||
for vec::each(m) |br| {
|
||||
for m.each |br| {
|
||||
match br.pats[col].node {
|
||||
ast::pat_ident(_, _, Some(_)) => return true,
|
||||
_ => ()
|
||||
@ -418,7 +418,7 @@ pub fn enter_match<'r>(bcx: block,
|
||||
let _indenter = indenter();
|
||||
|
||||
let mut result = ~[];
|
||||
for vec::each(m) |br| {
|
||||
for m.each |br| {
|
||||
match e(br.pats[col]) {
|
||||
Some(sub) => {
|
||||
let pats =
|
||||
@ -934,7 +934,7 @@ pub fn collect_record_or_struct_fields(bcx: block,
|
||||
col: uint)
|
||||
-> ~[ast::ident] {
|
||||
let mut fields: ~[ast::ident] = ~[];
|
||||
for vec::each(m) |br| {
|
||||
for m.each |br| {
|
||||
match br.pats[col].node {
|
||||
ast::pat_struct(_, ref fs, _) => {
|
||||
match ty::get(node_id_type(bcx, br.pats[col].id)).sty {
|
||||
@ -973,7 +973,7 @@ pub fn root_pats_as_necessary(mut bcx: block,
|
||||
col: uint,
|
||||
val: ValueRef)
|
||||
-> block {
|
||||
for vec::each(m) |br| {
|
||||
for m.each |br| {
|
||||
let pat_id = br.pats[col].id;
|
||||
if pat_id != 0 {
|
||||
let datum = Datum {val: val, ty: node_id_type(bcx, pat_id),
|
||||
@ -1042,14 +1042,14 @@ pub fn pick_col(m: &[@Match]) -> uint {
|
||||
}
|
||||
}
|
||||
let mut scores = vec::from_elem(m[0].pats.len(), 0u);
|
||||
for vec::each(m) |br| {
|
||||
for m.each |br| {
|
||||
let mut i = 0u;
|
||||
for vec::each(br.pats) |p| { scores[i] += score(*p); i += 1u; }
|
||||
for br.pats.each |p| { scores[i] += score(*p); i += 1u; }
|
||||
}
|
||||
let mut max_score = 0u;
|
||||
let mut best_col = 0u;
|
||||
let mut i = 0u;
|
||||
for vec::each(scores) |score| {
|
||||
for scores.each |score| {
|
||||
let score = *score;
|
||||
|
||||
// Irrefutable columns always go first, they'd only be duplicated in
|
||||
@ -1306,7 +1306,7 @@ pub fn compile_submatch(bcx: block,
|
||||
let ccx = *bcx.fcx.ccx;
|
||||
let mut pat_id = 0;
|
||||
let mut pat_span = dummy_sp();
|
||||
for vec::each(m) |br| {
|
||||
for m.each |br| {
|
||||
// Find a real id (we're adding placeholder wildcard patterns, but
|
||||
// each column is guaranteed to have at least one real pattern)
|
||||
if pat_id == 0 {
|
||||
@ -1438,7 +1438,7 @@ pub fn compile_submatch(bcx: block,
|
||||
}
|
||||
}
|
||||
}
|
||||
for vec::each(opts) |o| {
|
||||
for opts.each |o| {
|
||||
match *o {
|
||||
range(_, _) => { kind = compare; break }
|
||||
_ => ()
|
||||
@ -1460,7 +1460,7 @@ pub fn compile_submatch(bcx: block,
|
||||
let mut i = 0u;
|
||||
|
||||
// Compile subtrees for each option
|
||||
for vec::each(opts) |opt| {
|
||||
for opts.each |opt| {
|
||||
i += 1u;
|
||||
let mut opt_cx = else_cx;
|
||||
if !exhaustive || i < len {
|
||||
@ -1631,7 +1631,7 @@ pub fn trans_match_inner(scope_cx: block,
|
||||
}
|
||||
|
||||
let mut arm_datas = ~[], matches = ~[];
|
||||
for vec::each(arms) |arm| {
|
||||
for arms.each |arm| {
|
||||
let body = scope_block(bcx, arm.body.info(), ~"case_body");
|
||||
|
||||
// Create the bindings map, which is a mapping from each binding name
|
||||
@ -1670,7 +1670,7 @@ pub fn trans_match_inner(scope_cx: block,
|
||||
arm: arm,
|
||||
bindings_map: bindings_map};
|
||||
arm_datas.push(arm_data);
|
||||
for vec::each(arm.pats) |p| {
|
||||
for arm.pats.each |p| {
|
||||
matches.push(@Match {pats: ~[*p], data: arm_data});
|
||||
}
|
||||
}
|
||||
@ -1793,7 +1793,7 @@ pub fn bind_irrefutable_pat(bcx: block,
|
||||
vinfo.disr_val,
|
||||
val);
|
||||
for sub_pats.each |sub_pat| {
|
||||
for vec::eachi(args.vals) |i, argval| {
|
||||
for args.vals.eachi |i, argval| {
|
||||
bcx = bind_irrefutable_pat(bcx,
|
||||
sub_pat[i],
|
||||
*argval,
|
||||
|
@ -668,7 +668,7 @@ pub fn iter_structural_ty(cx: block, av: ValueRef, t: ty::t,
|
||||
ty::ty_struct(*) => {
|
||||
let repr = adt::represent_type(cx.ccx(), t);
|
||||
do expr::with_field_tys(cx.tcx(), t, None) |discr, field_tys| {
|
||||
for vec::eachi(field_tys) |i, field_ty| {
|
||||
for field_tys.eachi |i, field_ty| {
|
||||
let llfld_a = adt::trans_field_ptr(cx, repr, av, discr, i);
|
||||
cx = f(cx, llfld_a, field_ty.mt.ty);
|
||||
}
|
||||
@ -709,7 +709,7 @@ pub fn iter_structural_ty(cx: block, av: ValueRef, t: ty::t,
|
||||
n_variants);
|
||||
let next_cx = sub_block(cx, ~"enum-iter-next");
|
||||
|
||||
for vec::each(*variants) |variant| {
|
||||
for (*variants).each |variant| {
|
||||
let variant_cx =
|
||||
sub_block(cx, ~"enum-iter-variant-" +
|
||||
int::to_str(variant.disr_val));
|
||||
@ -888,7 +888,7 @@ pub fn need_invoke(bcx: block) -> bool {
|
||||
match cur.kind {
|
||||
block_scope(inf) => {
|
||||
let inf = &mut *inf; // FIXME(#5074) workaround old borrowck
|
||||
for vec::each(inf.cleanups) |cleanup| {
|
||||
for inf.cleanups.each |cleanup| {
|
||||
match *cleanup {
|
||||
clean(_, cleanup_type) | clean_temp(_, _, cleanup_type) => {
|
||||
if cleanup_type == normal_exit_and_unwind {
|
||||
@ -1391,7 +1391,7 @@ pub fn with_scope_datumblock(bcx: block, opt_node_info: Option<NodeInfo>,
|
||||
}
|
||||
|
||||
pub fn block_locals(b: &ast::blk, it: &fn(@ast::local)) {
|
||||
for vec::each(b.node.stmts) |s| {
|
||||
for b.node.stmts.each |s| {
|
||||
match s.node {
|
||||
ast::stmt_decl(d, _) => {
|
||||
match d.node {
|
||||
@ -1973,7 +1973,7 @@ pub fn trans_enum_variant(ccx: @CrateContext,
|
||||
repr, ty_to_str(ccx.tcx, enum_ty));
|
||||
|
||||
adt::trans_start_init(bcx, repr, fcx.llretptr.get(), disr);
|
||||
for vec::eachi(args) |i, va| {
|
||||
for args.eachi |i, va| {
|
||||
let lldestptr = adt::trans_field_ptr(bcx,
|
||||
repr,
|
||||
fcx.llretptr.get(),
|
||||
@ -2072,7 +2072,7 @@ pub fn trans_tuple_struct(ccx: @CrateContext,
|
||||
pub fn trans_enum_def(ccx: @CrateContext, enum_definition: &ast::enum_def,
|
||||
id: ast::node_id, vi: @~[ty::VariantInfo],
|
||||
i: &mut uint) {
|
||||
for vec::each(enum_definition.variants) |variant| {
|
||||
for enum_definition.variants.each |variant| {
|
||||
let disr_val = vi[*i].disr_val;
|
||||
*i += 1;
|
||||
|
||||
@ -2559,7 +2559,7 @@ pub fn trans_constant(ccx: @CrateContext, it: @ast::item) {
|
||||
node: it.id });
|
||||
let mut i = 0;
|
||||
let path = item_path(ccx, it);
|
||||
for vec::each((*enum_definition).variants) |variant| {
|
||||
for (*enum_definition).variants.each |variant| {
|
||||
let p = vec::append(/*bad*/copy path, ~[
|
||||
path_name(variant.node.name),
|
||||
path_name(special_idents::descrim)
|
||||
|
@ -161,7 +161,7 @@ fn classify_ty(ty: TypeRef) -> ~[x86_64_reg_class] {
|
||||
cls: &mut [x86_64_reg_class], i: uint,
|
||||
off: uint) {
|
||||
let mut field_off = off;
|
||||
for vec::each(tys) |ty| {
|
||||
for tys.each |ty| {
|
||||
field_off = align(field_off, *ty);
|
||||
classify(*ty, cls, i, field_off);
|
||||
field_off += ty_size(*ty);
|
||||
@ -283,7 +283,7 @@ fn classify_ty(ty: TypeRef) -> ~[x86_64_reg_class] {
|
||||
fn llreg_ty(cls: &[x86_64_reg_class]) -> TypeRef {
|
||||
fn llvec_len(cls: &[x86_64_reg_class]) -> uint {
|
||||
let mut len = 1u;
|
||||
for vec::each(cls) |c| {
|
||||
for cls.each |c| {
|
||||
if *c != sseup_class {
|
||||
break;
|
||||
}
|
||||
@ -370,7 +370,7 @@ fn x86_64_tys(atys: &[TypeRef],
|
||||
|
||||
let mut arg_tys = ~[];
|
||||
let mut attrs = ~[];
|
||||
for vec::each(atys) |t| {
|
||||
for atys.each |t| {
|
||||
let (ty, attr) = x86_64_ty(*t, is_pass_byval, ByValAttribute);
|
||||
arg_tys.push(ty);
|
||||
attrs.push(attr);
|
||||
|
@ -631,7 +631,7 @@ pub fn trans_args(cx: block,
|
||||
match args {
|
||||
ArgExprs(arg_exprs) => {
|
||||
let last = arg_exprs.len() - 1u;
|
||||
for vec::eachi(arg_exprs) |i, arg_expr| {
|
||||
for arg_exprs.eachi |i, arg_expr| {
|
||||
let arg_val = unpack_result!(bcx, {
|
||||
trans_arg_expr(bcx,
|
||||
arg_tys[i],
|
||||
|
@ -34,7 +34,7 @@ pub fn trans_block(bcx: block, b: &ast::blk, dest: expr::Dest) -> block {
|
||||
do block_locals(b) |local| {
|
||||
bcx = alloc_local(bcx, local);
|
||||
};
|
||||
for vec::each(b.node.stmts) |s| {
|
||||
for b.node.stmts.each |s| {
|
||||
debuginfo::update_source_pos(bcx, b.span);
|
||||
bcx = trans_stmt(bcx, *s);
|
||||
}
|
||||
@ -107,7 +107,7 @@ pub fn trans_if(bcx: block,
|
||||
pub fn join_blocks(parent_bcx: block, in_cxs: &[block]) -> block {
|
||||
let out = sub_block(parent_bcx, ~"join");
|
||||
let mut reachable = false;
|
||||
for vec::each(in_cxs) |bcx| {
|
||||
for in_cxs.each |bcx| {
|
||||
if !bcx.unreachable {
|
||||
Br(*bcx, out.llbb);
|
||||
reachable = true;
|
||||
|
@ -1264,7 +1264,7 @@ fn trans_adt(bcx: block, repr: &adt::Repr, discr: int,
|
||||
}
|
||||
}
|
||||
|
||||
for vec::each(temp_cleanups) |cleanup| {
|
||||
for temp_cleanups.each |cleanup| {
|
||||
revoke_clean(bcx, *cleanup);
|
||||
}
|
||||
return bcx;
|
||||
|
@ -294,7 +294,7 @@ pub fn trans_foreign_mod(ccx: @CrateContext,
|
||||
Some(abi) => abi,
|
||||
};
|
||||
|
||||
for vec::each(foreign_mod.items) |&foreign_item| {
|
||||
for foreign_mod.items.each |&foreign_item| {
|
||||
match foreign_item.node {
|
||||
ast::foreign_item_fn(*) => {
|
||||
let id = foreign_item.id;
|
||||
|
@ -51,7 +51,7 @@ pub fn trans_impl(ccx: @CrateContext, path: path, name: ast::ident,
|
||||
|
||||
if !generics.ty_params.is_empty() { return; }
|
||||
let sub_path = vec::append_one(path, path_name(name));
|
||||
for vec::each(methods) |method| {
|
||||
for methods.each |method| {
|
||||
if method.generics.ty_params.len() == 0u {
|
||||
let llfn = get_item_val(ccx, method.id);
|
||||
let path = vec::append_one(/*bad*/copy sub_path,
|
||||
|
@ -28,7 +28,6 @@ use util::common::indenter;
|
||||
use util::ppaux::ty_to_str;
|
||||
|
||||
use core::option::None;
|
||||
use core::vec;
|
||||
use syntax::ast;
|
||||
use syntax::codemap;
|
||||
|
||||
@ -395,7 +394,7 @@ pub fn write_content(bcx: block,
|
||||
add_clean_temp_mem(bcx, lleltptr, vt.unit_ty);
|
||||
temp_cleanups.push(lleltptr);
|
||||
}
|
||||
for vec::each(temp_cleanups) |cleanup| {
|
||||
for temp_cleanups.each |cleanup| {
|
||||
revoke_clean(bcx, *cleanup);
|
||||
}
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ pub fn type_uses_for(ccx: @CrateContext, fn_id: def_id, n_tps: uint)
|
||||
match ty::get(ty::lookup_item_type(cx.ccx.tcx, fn_id).ty).sty {
|
||||
ty::ty_bare_fn(ty::BareFnTy {sig: ref sig, _}) |
|
||||
ty::ty_closure(ty::ClosureTy {sig: ref sig, _}) => {
|
||||
for vec::each(sig.inputs) |arg| {
|
||||
for sig.inputs.each |arg| {
|
||||
type_needs(cx, use_repr, arg.ty);
|
||||
}
|
||||
}
|
||||
@ -213,7 +213,7 @@ pub fn type_needs_inner(cx: Context,
|
||||
if list::find(enums_seen, |id| *id == did).is_none() {
|
||||
let seen = @Cons(did, enums_seen);
|
||||
for vec::each(*ty::enum_variants(cx.ccx.tcx, did)) |v| {
|
||||
for vec::each(v.args) |aty| {
|
||||
for v.args.each |aty| {
|
||||
let t = ty::subst(cx.ccx.tcx, &(*substs), *aty);
|
||||
type_needs_inner(cx, use_, t, seen);
|
||||
}
|
||||
|
@ -1740,7 +1740,7 @@ fn type_needs_unwind_cleanup_(cx: ctxt, ty: t,
|
||||
true
|
||||
}
|
||||
ty_enum(did, ref substs) => {
|
||||
for vec::each(*enum_variants(cx, did)) |v| {
|
||||
for (*enum_variants(cx, did)).each |v| {
|
||||
for v.args.each |aty| {
|
||||
let t = subst(cx, substs, *aty);
|
||||
needs_unwind_cleanup |=
|
||||
@ -2335,7 +2335,7 @@ pub fn type_structurally_contains(cx: ctxt,
|
||||
if test(sty) { return true; }
|
||||
match *sty {
|
||||
ty_enum(did, ref substs) => {
|
||||
for vec::each(*enum_variants(cx, did)) |variant| {
|
||||
for (*enum_variants(cx, did)).each |variant| {
|
||||
for variant.args.each |aty| {
|
||||
let sty = subst(cx, substs, *aty);
|
||||
if type_structurally_contains(cx, sty, test) { return true; }
|
||||
@ -2431,7 +2431,7 @@ pub fn type_is_pod(cx: ctxt, ty: t) -> bool {
|
||||
// Structural types
|
||||
ty_enum(did, ref substs) => {
|
||||
let variants = enum_variants(cx, did);
|
||||
for vec::each(*variants) |variant| {
|
||||
for (*variants).each |variant| {
|
||||
let tup_ty = mk_tup(cx, /*bad*/copy variant.args);
|
||||
|
||||
// Perform any type parameter substitutions.
|
||||
|
@ -228,7 +228,7 @@ fn visit_expr(e: @ast::expr, wbcx: @mut WbCtxt, v: wb_vt) {
|
||||
|
||||
match e.node {
|
||||
ast::expr_fn_block(ref decl, _) => {
|
||||
for vec::each(decl.inputs) |input| {
|
||||
for decl.inputs.each |input| {
|
||||
let _ = resolve_type_vars_for_node(wbcx, e.span, input.id);
|
||||
}
|
||||
}
|
||||
|
@ -1572,8 +1572,8 @@ pub impl RegionVarBindings {
|
||||
return;
|
||||
}
|
||||
|
||||
for vec::each(lower_bounds) |lower_bound| {
|
||||
for vec::each(upper_bounds) |upper_bound| {
|
||||
for lower_bounds.each |lower_bound| {
|
||||
for upper_bounds.each |upper_bound| {
|
||||
if !self.is_subregion_of(lower_bound.region,
|
||||
upper_bound.region) {
|
||||
|
||||
@ -1629,8 +1629,8 @@ pub impl RegionVarBindings {
|
||||
return;
|
||||
}
|
||||
|
||||
for vec::each(upper_bounds) |upper_bound_1| {
|
||||
for vec::each(upper_bounds) |upper_bound_2| {
|
||||
for upper_bounds.each |upper_bound_1| {
|
||||
for upper_bounds.each |upper_bound_2| {
|
||||
match self.glb_concrete_regions(upper_bound_1.region,
|
||||
upper_bound_2.region) {
|
||||
Ok(_) => {}
|
||||
|
@ -276,7 +276,7 @@ fn write_desc(
|
||||
}
|
||||
|
||||
fn write_sections(ctxt: &Ctxt, sections: &[doc::Section]) {
|
||||
for vec::each(sections) |section| {
|
||||
for sections.each |section| {
|
||||
write_section(ctxt, copy *section);
|
||||
}
|
||||
}
|
||||
@ -439,7 +439,7 @@ fn write_variants(
|
||||
|
||||
write_header_(ctxt, H4, ~"Variants");
|
||||
|
||||
for vec::each(docs) |variant| {
|
||||
for docs.each |variant| {
|
||||
write_variant(ctxt, copy *variant);
|
||||
}
|
||||
|
||||
@ -465,7 +465,7 @@ fn write_trait(ctxt: &Ctxt, doc: doc::TraitDoc) {
|
||||
}
|
||||
|
||||
fn write_methods(ctxt: &Ctxt, docs: &[doc::MethodDoc]) {
|
||||
for vec::each(docs) |doc| {
|
||||
for docs.each |doc| {
|
||||
write_method(ctxt, copy *doc);
|
||||
}
|
||||
}
|
||||
|
@ -484,7 +484,6 @@ mod tests {
|
||||
|
||||
use core::cell::Cell;
|
||||
use core::task;
|
||||
use core::vec;
|
||||
|
||||
#[test]
|
||||
fn manually_share_arc() {
|
||||
@ -683,7 +682,7 @@ mod tests {
|
||||
}
|
||||
|
||||
// Wait for children to pass their asserts
|
||||
for vec::each(children) |r| {
|
||||
for children.each |r| {
|
||||
r.recv();
|
||||
}
|
||||
|
||||
@ -748,7 +747,7 @@ mod tests {
|
||||
assert!(*state == 42);
|
||||
*state = 31337;
|
||||
// send to other readers
|
||||
for vec::each(reader_convos) |x| {
|
||||
for reader_convos.each |x| {
|
||||
match *x {
|
||||
(ref rc, _) => rc.send(()),
|
||||
}
|
||||
@ -757,7 +756,7 @@ mod tests {
|
||||
let read_mode = arc.downgrade(write_mode);
|
||||
do (&read_mode).read |state| {
|
||||
// complete handshake with other readers
|
||||
for vec::each(reader_convos) |x| {
|
||||
for reader_convos.each |x| {
|
||||
match *x {
|
||||
(_, ref rp) => rp.recv(),
|
||||
}
|
||||
|
@ -368,7 +368,7 @@ pub fn opt_count(mm: &Matches, nm: &str) -> uint {
|
||||
|
||||
/// Returns true if any of several options were matched
|
||||
pub fn opts_present(mm: &Matches, names: &[~str]) -> bool {
|
||||
for vec::each(names) |nm| {
|
||||
for names.each |nm| {
|
||||
match find_opt(mm.opts, mkname(*nm)) {
|
||||
Some(id) if !mm.vals[id].is_empty() => return true,
|
||||
_ => (),
|
||||
@ -395,7 +395,7 @@ pub fn opt_str(mm: &Matches, nm: &str) -> ~str {
|
||||
* option took an argument
|
||||
*/
|
||||
pub fn opts_str(mm: &Matches, names: &[~str]) -> ~str {
|
||||
for vec::each(names) |nm| {
|
||||
for names.each |nm| {
|
||||
match opt_val(mm, *nm) {
|
||||
Val(copy s) => return s,
|
||||
_ => ()
|
||||
|
@ -425,7 +425,7 @@ mod test {
|
||||
let results = result::unwrap(ga_result);
|
||||
debug!("test_get_addr: Number of results for %s: %?",
|
||||
localhost_name, vec::len(results));
|
||||
for vec::each(results) |r| {
|
||||
for results.each |r| {
|
||||
let ipv_prefix = match *r {
|
||||
Ipv4(_) => ~"IPv4",
|
||||
Ipv6(_) => ~"IPv6"
|
||||
|
@ -250,7 +250,7 @@ pub fn sha1() -> @Sha1 {
|
||||
fn result_str(&mut self) -> ~str {
|
||||
let rr = mk_result(self);
|
||||
let mut s = ~"";
|
||||
for vec::each(rr) |b| {
|
||||
for rr.each |b| {
|
||||
let hex = uint::to_str_radix(*b as uint, 16u);
|
||||
if hex.len() == 1 {
|
||||
s += "0";
|
||||
@ -378,7 +378,7 @@ mod tests {
|
||||
// Test that it works when accepting the message all at once
|
||||
|
||||
let mut sh = sha1::sha1();
|
||||
for vec::each(tests) |t| {
|
||||
for tests.each |t| {
|
||||
sh.input_str(t.input);
|
||||
let out = sh.result();
|
||||
check_vec_eq(t.output, out);
|
||||
@ -392,7 +392,7 @@ mod tests {
|
||||
|
||||
|
||||
// Test that it works when accepting the message in pieces
|
||||
for vec::each(tests) |t| {
|
||||
for tests.each |t| {
|
||||
let len = str::len(t.input);
|
||||
let mut left = len;
|
||||
while left > 0u {
|
||||
|
@ -859,7 +859,7 @@ mod test_qsort {
|
||||
let immut_names = names;
|
||||
|
||||
let pairs = vec::zip_slice(expected, immut_names);
|
||||
for vec::each(pairs) |p| {
|
||||
for pairs.each |p| {
|
||||
let (a, b) = *p;
|
||||
debug!("%d %d", a, b);
|
||||
assert!((a == b));
|
||||
|
@ -852,7 +852,7 @@ mod test_qsort {
|
||||
let immut_names = names;
|
||||
|
||||
let pairs = vec::zip_slice(expected, immut_names);
|
||||
for vec::each(pairs) |p| {
|
||||
for pairs.each |p| {
|
||||
let (a, b) = *p;
|
||||
debug!("%d %d", a, b);
|
||||
assert!((a == b));
|
||||
|
@ -997,7 +997,7 @@ mod tests {
|
||||
}
|
||||
}
|
||||
}
|
||||
for vec::each(sibling_convos) |p| {
|
||||
for sibling_convos.each |p| {
|
||||
let _ = p.recv(); // wait for sibling to get in the mutex
|
||||
}
|
||||
do m2.lock { }
|
||||
|
@ -13,7 +13,6 @@
|
||||
use core::io;
|
||||
use core::option;
|
||||
use core::os;
|
||||
use core::vec;
|
||||
|
||||
// FIXME (#2807): Windows support.
|
||||
|
||||
@ -50,7 +49,7 @@ pub fn color_supported() -> bool {
|
||||
~"screen-bce", ~"xterm-256color"];
|
||||
return match os::getenv(~"TERM") {
|
||||
option::Some(ref env) => {
|
||||
for vec::each(supported_terms) |term| {
|
||||
for supported_terms.each |term| {
|
||||
if *term == *env { return true; }
|
||||
}
|
||||
false
|
||||
|
@ -355,7 +355,7 @@ fn print_failures(st: &ConsoleTestState) {
|
||||
failures.push(name.to_str());
|
||||
}
|
||||
sort::tim_sort(failures);
|
||||
for vec::each(failures) |name| {
|
||||
for failures.each |name| {
|
||||
st.out.write_line(fmt!(" %s", name.to_str()));
|
||||
}
|
||||
}
|
||||
@ -928,7 +928,7 @@ mod tests {
|
||||
{
|
||||
fn testfn() { }
|
||||
let mut tests = ~[];
|
||||
for vec::each(names) |name| {
|
||||
for names.each |name| {
|
||||
let test = TestDescAndFn {
|
||||
desc: TestDesc {
|
||||
name: DynTestName(*name),
|
||||
@ -954,7 +954,7 @@ mod tests {
|
||||
|
||||
let pairs = vec::zip(expected, filtered);
|
||||
|
||||
for vec::each(pairs) |p| {
|
||||
for pairs.each |p| {
|
||||
match *p {
|
||||
(ref a, ref b) => {
|
||||
assert!((*a == b.desc.name.to_str()));
|
||||
|
@ -861,7 +861,6 @@ mod tests {
|
||||
use core::result;
|
||||
use core::result::{Err, Ok};
|
||||
use core::str;
|
||||
use core::vec;
|
||||
|
||||
fn test_get_time() {
|
||||
static some_recent_date: i64 = 1325376000i64; // 2012-01-01T00:00:00Z
|
||||
@ -1028,7 +1027,7 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
for vec::each([
|
||||
for [
|
||||
~"Sunday",
|
||||
~"Monday",
|
||||
~"Tuesday",
|
||||
@ -1036,11 +1035,11 @@ mod tests {
|
||||
~"Thursday",
|
||||
~"Friday",
|
||||
~"Saturday"
|
||||
]) |day| {
|
||||
].each |day| {
|
||||
assert!(test(*day, ~"%A"));
|
||||
}
|
||||
|
||||
for vec::each([
|
||||
for [
|
||||
~"Sun",
|
||||
~"Mon",
|
||||
~"Tue",
|
||||
@ -1048,11 +1047,11 @@ mod tests {
|
||||
~"Thu",
|
||||
~"Fri",
|
||||
~"Sat"
|
||||
]) |day| {
|
||||
].each |day| {
|
||||
assert!(test(*day, ~"%a"));
|
||||
}
|
||||
|
||||
for vec::each([
|
||||
for [
|
||||
~"January",
|
||||
~"February",
|
||||
~"March",
|
||||
@ -1065,11 +1064,11 @@ mod tests {
|
||||
~"October",
|
||||
~"November",
|
||||
~"December"
|
||||
]) |day| {
|
||||
].each |day| {
|
||||
assert!(test(*day, ~"%B"));
|
||||
}
|
||||
|
||||
for vec::each([
|
||||
for [
|
||||
~"Jan",
|
||||
~"Feb",
|
||||
~"Mar",
|
||||
@ -1082,7 +1081,7 @@ mod tests {
|
||||
~"Oct",
|
||||
~"Nov",
|
||||
~"Dec"
|
||||
]) |day| {
|
||||
].each |day| {
|
||||
assert!(test(*day, ~"%b"));
|
||||
}
|
||||
|
||||
|
@ -461,7 +461,7 @@ pub fn id_visitor(vfn: @fn(node_id)) -> visit::vt<()> {
|
||||
}
|
||||
}
|
||||
|
||||
for vec::each(d.inputs) |arg| {
|
||||
for d.inputs.each |arg| {
|
||||
vfn(arg.id)
|
||||
}
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user