Skip to content

Commit f53c294

Browse files
committed
Rename variables that clash with keywords
1 parent 9007afa commit f53c294

File tree

7 files changed

+43
-43
lines changed

7 files changed

+43
-43
lines changed

src/libcore/comm.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -420,17 +420,17 @@ fn test_select2_stress() {
420420
};
421421
}
422422
423-
let mut as = 0;
423+
let mut as_ = 0;
424424
let mut bs = 0;
425425
for iter::repeat(msgs * times * 2u) {
426426
match select2(po_a, po_b) {
427-
either::Left(~"a") => as += 1,
427+
either::Left(~"a") => as_ += 1,
428428
either::Right(~"b") => bs += 1,
429429
_ => fail ~"test_select_2_stress failed"
430430
}
431431
}
432432

433-
assert as == 400;
433+
assert as_ == 400;
434434
assert bs == 400;
435435
}
436436

src/libcore/vec.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,15 +1029,15 @@ pure fn rposition_between<T>(v: &[T], start: uint, end: uint,
10291029
* Convert a vector of pairs into a pair of vectors, by reference. As unzip().
10301030
*/
10311031
pure fn unzip_slice<T: Copy, U: Copy>(v: &[(T, U)]) -> (~[T], ~[U]) {
1032-
let mut as = ~[], bs = ~[];
1032+
let mut as_ = ~[], bs = ~[];
10331033
for each(v) |p| {
10341034
let (a, b) = p;
10351035
unchecked {
1036-
vec::push(as, a);
1036+
vec::push(as_, a);
10371037
vec::push(bs, b);
10381038
}
10391039
}
1040-
return (as, bs);
1040+
return (as_, bs);
10411041
}
10421042

10431043
/**

src/rustc/middle/trans/type_use.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,17 +116,17 @@ fn type_uses_for(ccx: @crate_ctxt, fn_id: def_id, n_tps: uint)
116116
uses
117117
}
118118

119-
fn type_needs(cx: ctx, use: uint, ty: ty::t) {
119+
fn type_needs(cx: ctx, use_: uint, ty: ty::t) {
120120
// Optimization -- don't descend type if all params already have this use
121121
for vec::each_mut(cx.uses) |u| {
122-
if *u & use != use {
123-
type_needs_inner(cx, use, ty, @Nil);
122+
if *u & use_ != use_ {
123+
type_needs_inner(cx, use_, ty, @Nil);
124124
return;
125125
}
126126
}
127127
}
128128

129-
fn type_needs_inner(cx: ctx, use: uint, ty: ty::t,
129+
fn type_needs_inner(cx: ctx, use_: uint, ty: ty::t,
130130
enums_seen: @List<def_id>) {
131131
do ty::maybe_walk_ty(ty) |ty| {
132132
if ty::type_has_params(ty) {
@@ -145,14 +145,14 @@ fn type_needs_inner(cx: ctx, use: uint, ty: ty::t,
145145
for vec::each(*ty::enum_variants(cx.ccx.tcx, did)) |v| {
146146
for vec::each(v.args) |aty| {
147147
let t = ty::subst(cx.ccx.tcx, &substs, aty);
148-
type_needs_inner(cx, use, t, seen);
148+
type_needs_inner(cx, use_, t, seen);
149149
}
150150
}
151151
}
152152
false
153153
}
154154
ty::ty_param(p) => {
155-
cx.uses[p.idx] |= use;
155+
cx.uses[p.idx] |= use_;
156156
false
157157
}
158158
_ => true
@@ -161,8 +161,8 @@ fn type_needs_inner(cx: ctx, use: uint, ty: ty::t,
161161
}
162162
}
163163

164-
fn node_type_needs(cx: ctx, use: uint, id: node_id) {
165-
type_needs(cx, use, ty::node_id_to_type(cx.ccx.tcx, id));
164+
fn node_type_needs(cx: ctx, use_: uint, id: node_id) {
165+
type_needs(cx, use_, ty::node_id_to_type(cx.ccx.tcx, id));
166166
}
167167

168168
fn mark_for_expr(cx: ctx, e: @expr) {

src/rustc/middle/typeck/infer/combine.rs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ trait combine {
5959
fn mts(a: ty::mt, b: ty::mt) -> cres<ty::mt>;
6060
fn contratys(a: ty::t, b: ty::t) -> cres<ty::t>;
6161
fn tys(a: ty::t, b: ty::t) -> cres<ty::t>;
62-
fn tps(as: &[ty::t], bs: &[ty::t]) -> cres<~[ty::t]>;
62+
fn tps(as_: &[ty::t], bs: &[ty::t]) -> cres<~[ty::t]>;
6363
fn self_tys(a: Option<ty::t>, b: Option<ty::t>) -> cres<Option<ty::t>>;
64-
fn substs(did: ast::def_id, as: &ty::substs,
64+
fn substs(did: ast::def_id, as_: &ty::substs,
6565
bs: &ty::substs) -> cres<ty::substs>;
6666
fn fns(a: &ty::FnTy, b: &ty::FnTy) -> cres<ty::FnTy>;
6767
fn fn_sigs(a: &ty::FnSig, b: &ty::FnSig) -> cres<ty::FnSig>;
@@ -212,20 +212,20 @@ fn super_substs<C:combine>(
212212
}
213213

214214
fn super_tps<C:combine>(
215-
self: &C, as: &[ty::t], bs: &[ty::t]) -> cres<~[ty::t]> {
215+
self: &C, as_: &[ty::t], bs: &[ty::t]) -> cres<~[ty::t]> {
216216

217217
// Note: type parameters are always treated as *invariant*
218218
// (otherwise the type system would be unsound). In the
219219
// future we could allow type parameters to declare a
220220
// variance.
221221

222-
if vec::same_length(as, bs) {
223-
iter_vec2(as, bs, |a, b| {
222+
if vec::same_length(as_, bs) {
223+
iter_vec2(as_, bs, |a, b| {
224224
eq_tys(self, a, b)
225-
}).then(|| Ok(as.to_vec()) )
225+
}).then(|| Ok(as_.to_vec()) )
226226
} else {
227227
Err(ty::terr_ty_param_size(
228-
expected_found(self, as.len(), bs.len())))
228+
expected_found(self, as_.len(), bs.len())))
229229
}
230230
}
231231

@@ -383,9 +383,9 @@ fn super_tys<C:combine>(
383383
(ty::ty_int(_), _) |
384384
(ty::ty_uint(_), _) |
385385
(ty::ty_float(_), _) => {
386-
let as = ty::get(a).struct;
386+
let as_ = ty::get(a).struct;
387387
let bs = ty::get(b).struct;
388-
if as == bs {
388+
if as_ == bs {
389389
Ok(a)
390390
} else {
391391
Err(ty::terr_sorts(expected_found(self, a, b)))
@@ -471,23 +471,23 @@ fn super_tys<C:combine>(
471471
}
472472
}
473473

474-
(ty::ty_rec(as), ty::ty_rec(bs)) => {
475-
if vec::same_length(as, bs) {
476-
map_vec2(as, bs, |a,b| {
474+
(ty::ty_rec(as_), ty::ty_rec(bs)) => {
475+
if vec::same_length(as_, bs) {
476+
map_vec2(as_, bs, |a,b| {
477477
self.flds(a, b)
478478
}).chain(|flds| Ok(ty::mk_rec(tcx, flds)) )
479479
} else {
480-
Err(ty::terr_record_size(expected_found(self, as.len(),
480+
Err(ty::terr_record_size(expected_found(self, as_.len(),
481481
bs.len())))
482482
}
483483
}
484484

485-
(ty::ty_tup(as), ty::ty_tup(bs)) => {
486-
if vec::same_length(as, bs) {
487-
map_vec2(as, bs, |a, b| self.tys(a, b) )
485+
(ty::ty_tup(as_), ty::ty_tup(bs)) => {
486+
if vec::same_length(as_, bs) {
487+
map_vec2(as_, bs, |a, b| self.tys(a, b) )
488488
.chain(|ts| Ok(ty::mk_tup(tcx, ts)) )
489489
} else {
490-
Err(ty::terr_tuple_size(expected_found(self, as.len(), bs.len())))
490+
Err(ty::terr_tuple_size(expected_found(self, as_.len(), bs.len())))
491491
}
492492
}
493493

src/rustc/middle/typeck/infer/glb.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,13 +160,13 @@ impl Glb: combine {
160160
}
161161

162162
fn substs(did: ast::def_id,
163-
as: &ty::substs,
163+
as_: &ty::substs,
164164
bs: &ty::substs) -> cres<ty::substs> {
165-
super_substs(&self, did, as, bs)
165+
super_substs(&self, did, as_, bs)
166166
}
167167

168-
fn tps(as: &[ty::t], bs: &[ty::t]) -> cres<~[ty::t]> {
169-
super_tps(&self, as, bs)
168+
fn tps(as_: &[ty::t], bs: &[ty::t]) -> cres<~[ty::t]> {
169+
super_tps(&self, as_, bs)
170170
}
171171

172172
fn self_tys(a: Option<ty::t>, b: Option<ty::t>) -> cres<Option<ty::t>> {

src/rustc/middle/typeck/infer/lub.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,13 @@ impl Lub: combine {
139139
}
140140

141141
fn substs(did: ast::def_id,
142-
as: &ty::substs,
142+
as_: &ty::substs,
143143
bs: &ty::substs) -> cres<ty::substs> {
144-
super_substs(&self, did, as, bs)
144+
super_substs(&self, did, as_, bs)
145145
}
146146

147-
fn tps(as: &[ty::t], bs: &[ty::t]) -> cres<~[ty::t]> {
148-
super_tps(&self, as, bs)
147+
fn tps(as_: &[ty::t], bs: &[ty::t]) -> cres<~[ty::t]> {
148+
super_tps(&self, as_, bs)
149149
}
150150

151151
fn self_tys(a: Option<ty::t>, b: Option<ty::t>) -> cres<Option<ty::t>> {

src/rustc/middle/typeck/infer/sub.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,13 +193,13 @@ impl Sub: combine {
193193
}
194194

195195
fn substs(did: ast::def_id,
196-
as: &ty::substs,
196+
as_: &ty::substs,
197197
bs: &ty::substs) -> cres<ty::substs> {
198-
super_substs(&self, did, as, bs)
198+
super_substs(&self, did, as_, bs)
199199
}
200200

201-
fn tps(as: &[ty::t], bs: &[ty::t]) -> cres<~[ty::t]> {
202-
super_tps(&self, as, bs)
201+
fn tps(as_: &[ty::t], bs: &[ty::t]) -> cres<~[ty::t]> {
202+
super_tps(&self, as_, bs)
203203
}
204204

205205
fn self_tys(a: Option<ty::t>, b: Option<ty::t>) -> cres<Option<ty::t>> {

0 commit comments

Comments
 (0)