Rename variables that clash with keywords

This commit is contained in:
Brian Anderson 2012-09-09 16:53:19 -07:00
parent 9007afab0a
commit f53c2948aa
7 changed files with 43 additions and 43 deletions

View File

@ -420,17 +420,17 @@ fn test_select2_stress() {
};
}
let mut as = 0;
let mut as_ = 0;
let mut bs = 0;
for iter::repeat(msgs * times * 2u) {
match select2(po_a, po_b) {
either::Left(~"a") => as += 1,
either::Left(~"a") => as_ += 1,
either::Right(~"b") => bs += 1,
_ => fail ~"test_select_2_stress failed"
}
}
assert as == 400;
assert as_ == 400;
assert bs == 400;
}

View File

@ -1029,15 +1029,15 @@ pure fn rposition_between<T>(v: &[T], start: uint, end: uint,
* Convert a vector of pairs into a pair of vectors, by reference. As unzip().
*/
pure fn unzip_slice<T: Copy, U: Copy>(v: &[(T, U)]) -> (~[T], ~[U]) {
let mut as = ~[], bs = ~[];
let mut as_ = ~[], bs = ~[];
for each(v) |p| {
let (a, b) = p;
unchecked {
vec::push(as, a);
vec::push(as_, a);
vec::push(bs, b);
}
}
return (as, bs);
return (as_, bs);
}
/**

View File

@ -116,17 +116,17 @@ fn type_uses_for(ccx: @crate_ctxt, fn_id: def_id, n_tps: uint)
uses
}
fn type_needs(cx: ctx, use: uint, ty: ty::t) {
fn type_needs(cx: ctx, use_: uint, ty: ty::t) {
// Optimization -- don't descend type if all params already have this use
for vec::each_mut(cx.uses) |u| {
if *u & use != use {
type_needs_inner(cx, use, ty, @Nil);
if *u & use_ != use_ {
type_needs_inner(cx, use_, ty, @Nil);
return;
}
}
}
fn type_needs_inner(cx: ctx, use: uint, ty: ty::t,
fn type_needs_inner(cx: ctx, use_: uint, ty: ty::t,
enums_seen: @List<def_id>) {
do ty::maybe_walk_ty(ty) |ty| {
if ty::type_has_params(ty) {
@ -145,14 +145,14 @@ fn type_needs_inner(cx: ctx, use: uint, ty: ty::t,
for vec::each(*ty::enum_variants(cx.ccx.tcx, did)) |v| {
for vec::each(v.args) |aty| {
let t = ty::subst(cx.ccx.tcx, &substs, aty);
type_needs_inner(cx, use, t, seen);
type_needs_inner(cx, use_, t, seen);
}
}
}
false
}
ty::ty_param(p) => {
cx.uses[p.idx] |= use;
cx.uses[p.idx] |= use_;
false
}
_ => true
@ -161,8 +161,8 @@ fn type_needs_inner(cx: ctx, use: uint, ty: ty::t,
}
}
fn node_type_needs(cx: ctx, use: uint, id: node_id) {
type_needs(cx, use, ty::node_id_to_type(cx.ccx.tcx, id));
fn node_type_needs(cx: ctx, use_: uint, id: node_id) {
type_needs(cx, use_, ty::node_id_to_type(cx.ccx.tcx, id));
}
fn mark_for_expr(cx: ctx, e: @expr) {

View File

@ -59,9 +59,9 @@ trait combine {
fn mts(a: ty::mt, b: ty::mt) -> cres<ty::mt>;
fn contratys(a: ty::t, b: ty::t) -> cres<ty::t>;
fn tys(a: ty::t, b: ty::t) -> cres<ty::t>;
fn tps(as: &[ty::t], bs: &[ty::t]) -> cres<~[ty::t]>;
fn tps(as_: &[ty::t], bs: &[ty::t]) -> cres<~[ty::t]>;
fn self_tys(a: Option<ty::t>, b: Option<ty::t>) -> cres<Option<ty::t>>;
fn substs(did: ast::def_id, as: &ty::substs,
fn substs(did: ast::def_id, as_: &ty::substs,
bs: &ty::substs) -> cres<ty::substs>;
fn fns(a: &ty::FnTy, b: &ty::FnTy) -> cres<ty::FnTy>;
fn fn_sigs(a: &ty::FnSig, b: &ty::FnSig) -> cres<ty::FnSig>;
@ -212,20 +212,20 @@ fn super_substs<C:combine>(
}
fn super_tps<C:combine>(
self: &C, as: &[ty::t], bs: &[ty::t]) -> cres<~[ty::t]> {
self: &C, as_: &[ty::t], bs: &[ty::t]) -> cres<~[ty::t]> {
// Note: type parameters are always treated as *invariant*
// (otherwise the type system would be unsound). In the
// future we could allow type parameters to declare a
// variance.
if vec::same_length(as, bs) {
iter_vec2(as, bs, |a, b| {
if vec::same_length(as_, bs) {
iter_vec2(as_, bs, |a, b| {
eq_tys(self, a, b)
}).then(|| Ok(as.to_vec()) )
}).then(|| Ok(as_.to_vec()) )
} else {
Err(ty::terr_ty_param_size(
expected_found(self, as.len(), bs.len())))
expected_found(self, as_.len(), bs.len())))
}
}
@ -383,9 +383,9 @@ fn super_tys<C:combine>(
(ty::ty_int(_), _) |
(ty::ty_uint(_), _) |
(ty::ty_float(_), _) => {
let as = ty::get(a).struct;
let as_ = ty::get(a).struct;
let bs = ty::get(b).struct;
if as == bs {
if as_ == bs {
Ok(a)
} else {
Err(ty::terr_sorts(expected_found(self, a, b)))
@ -471,23 +471,23 @@ fn super_tys<C:combine>(
}
}
(ty::ty_rec(as), ty::ty_rec(bs)) => {
if vec::same_length(as, bs) {
map_vec2(as, bs, |a,b| {
(ty::ty_rec(as_), ty::ty_rec(bs)) => {
if vec::same_length(as_, bs) {
map_vec2(as_, bs, |a,b| {
self.flds(a, b)
}).chain(|flds| Ok(ty::mk_rec(tcx, flds)) )
} else {
Err(ty::terr_record_size(expected_found(self, as.len(),
Err(ty::terr_record_size(expected_found(self, as_.len(),
bs.len())))
}
}
(ty::ty_tup(as), ty::ty_tup(bs)) => {
if vec::same_length(as, bs) {
map_vec2(as, bs, |a, b| self.tys(a, b) )
(ty::ty_tup(as_), ty::ty_tup(bs)) => {
if vec::same_length(as_, bs) {
map_vec2(as_, bs, |a, b| self.tys(a, b) )
.chain(|ts| Ok(ty::mk_tup(tcx, ts)) )
} else {
Err(ty::terr_tuple_size(expected_found(self, as.len(), bs.len())))
Err(ty::terr_tuple_size(expected_found(self, as_.len(), bs.len())))
}
}

View File

@ -160,13 +160,13 @@ impl Glb: combine {
}
fn substs(did: ast::def_id,
as: &ty::substs,
as_: &ty::substs,
bs: &ty::substs) -> cres<ty::substs> {
super_substs(&self, did, as, bs)
super_substs(&self, did, as_, bs)
}
fn tps(as: &[ty::t], bs: &[ty::t]) -> cres<~[ty::t]> {
super_tps(&self, as, bs)
fn tps(as_: &[ty::t], bs: &[ty::t]) -> cres<~[ty::t]> {
super_tps(&self, as_, bs)
}
fn self_tys(a: Option<ty::t>, b: Option<ty::t>) -> cres<Option<ty::t>> {

View File

@ -139,13 +139,13 @@ impl Lub: combine {
}
fn substs(did: ast::def_id,
as: &ty::substs,
as_: &ty::substs,
bs: &ty::substs) -> cres<ty::substs> {
super_substs(&self, did, as, bs)
super_substs(&self, did, as_, bs)
}
fn tps(as: &[ty::t], bs: &[ty::t]) -> cres<~[ty::t]> {
super_tps(&self, as, bs)
fn tps(as_: &[ty::t], bs: &[ty::t]) -> cres<~[ty::t]> {
super_tps(&self, as_, bs)
}
fn self_tys(a: Option<ty::t>, b: Option<ty::t>) -> cres<Option<ty::t>> {

View File

@ -193,13 +193,13 @@ impl Sub: combine {
}
fn substs(did: ast::def_id,
as: &ty::substs,
as_: &ty::substs,
bs: &ty::substs) -> cres<ty::substs> {
super_substs(&self, did, as, bs)
super_substs(&self, did, as_, bs)
}
fn tps(as: &[ty::t], bs: &[ty::t]) -> cres<~[ty::t]> {
super_tps(&self, as, bs)
fn tps(as_: &[ty::t], bs: &[ty::t]) -> cres<~[ty::t]> {
super_tps(&self, as_, bs)
}
fn self_tys(a: Option<ty::t>, b: Option<ty::t>) -> cres<Option<ty::t>> {