Skip to content

Commit ff03335

Browse files
committed
auto merge of #12955 : sfackler/rust/vec_ng-doc, r=alexcrichton
I also removed a couple of methods that were silly and added sort.
2 parents a39c294 + 0f2d46f commit ff03335

File tree

10 files changed

+626
-46
lines changed

10 files changed

+626
-46
lines changed

src/libnum/bigint.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ impl TotalOrd for BigUint {
117117
if s_len < o_len { return Less; }
118118
if s_len > o_len { return Greater; }
119119

120-
for (&self_i, &other_i) in self.data.rev_iter().zip(other.data.rev_iter()) {
120+
for (&self_i, &other_i) in self.data.iter().rev().zip(other.data.iter().rev()) {
121121
if self_i < other_i { return Less; }
122122
if self_i > other_i { return Greater; }
123123
}
@@ -788,7 +788,7 @@ impl BigUint {
788788

789789
let mut borrow = 0;
790790
let mut shifted_rev = Vec::with_capacity(self.data.len());
791-
for elem in self.data.rev_iter() {
791+
for elem in self.data.iter().rev() {
792792
shifted_rev.push((*elem >> n_bits) | borrow);
793793
borrow = *elem << (BigDigit::bits - n_bits);
794794
}

src/librustc/middle/check_match.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ fn is_useful(cx: &MatchCheckCtxt, m: &matrix, v: &[@Pat]) -> useful {
288288
is_useful_specialized(cx, m, v, vec(n), n, left_ty)
289289
}
290290
ty::ty_unboxed_vec(..) | ty::ty_vec(..) => {
291-
let max_len = m.rev_iter().fold(0, |max_len, r| {
291+
let max_len = m.iter().rev().fold(0, |max_len, r| {
292292
match r.get(0).node {
293293
PatVec(ref before, _, ref after) => {
294294
cmp::max(before.len() + after.len(), max_len)

src/librustc/middle/liveness.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,7 @@ impl<'a> Liveness<'a> {
879879
fn propagate_through_block(&mut self, blk: &Block, succ: LiveNode)
880880
-> LiveNode {
881881
let succ = self.propagate_through_opt_expr(blk.expr, succ);
882-
blk.stmts.rev_iter().fold(succ, |succ, stmt| {
882+
blk.stmts.iter().rev().fold(succ, |succ, stmt| {
883883
self.propagate_through_stmt(*stmt, succ)
884884
})
885885
}
@@ -980,7 +980,7 @@ impl<'a> Liveness<'a> {
980980
this.ir.tcx.sess.span_bug(expr.span, "no registered caps");
981981
}
982982
};
983-
caps.deref().rev_iter().fold(succ, |succ, cap| {
983+
caps.deref().iter().rev().fold(succ, |succ, cap| {
984984
this.init_from_succ(cap.ln, succ);
985985
let var = this.variable(cap.var_nid, expr.span);
986986
this.acc(cap.ln, var, ACC_READ | ACC_USE);
@@ -1121,7 +1121,7 @@ impl<'a> Liveness<'a> {
11211121

11221122
ExprStruct(_, ref fields, with_expr) => {
11231123
let succ = self.propagate_through_opt_expr(with_expr, succ);
1124-
fields.rev_iter().fold(succ, |succ, field| {
1124+
fields.iter().rev().fold(succ, |succ, field| {
11251125
self.propagate_through_expr(field.expr, succ)
11261126
})
11271127
}
@@ -1173,14 +1173,14 @@ impl<'a> Liveness<'a> {
11731173
}
11741174

11751175
ExprInlineAsm(ref ia) => {
1176-
let succ = ia.outputs.rev_iter().fold(succ, |succ, &(_, expr)| {
1176+
let succ = ia.outputs.iter().rev().fold(succ, |succ, &(_, expr)| {
11771177
// see comment on lvalues in
11781178
// propagate_through_lvalue_components()
11791179
let succ = self.write_lvalue(expr, succ, ACC_WRITE);
11801180
self.propagate_through_lvalue_components(expr, succ)
11811181
});
11821182
// Inputs are executed first. Propagate last because of rev order
1183-
ia.inputs.rev_iter().fold(succ, |succ, &(_, expr)| {
1183+
ia.inputs.iter().rev().fold(succ, |succ, &(_, expr)| {
11841184
self.propagate_through_expr(expr, succ)
11851185
})
11861186
}

src/librustc/middle/resolve.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -5520,7 +5520,8 @@ impl<'a> Resolver<'a> {
55205520
if idents.len() == 0 {
55215521
return ~"???";
55225522
}
5523-
return self.idents_to_str(idents.move_rev_iter()
5523+
return self.idents_to_str(idents.move_iter()
5524+
.rev()
55245525
.collect::<Vec<ast::Ident>>()
55255526
.as_slice());
55265527
}

src/librustc/middle/typeck/check/vtable.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ fn lookup_vtables(vcx: &VtableContext,
9494
// We do this backwards for reasons discussed above.
9595
assert_eq!(substs.tps.len(), type_param_defs.len());
9696
let mut result: Vec<vtable_param_res> =
97-
substs.tps.rev_iter()
97+
substs.tps.iter()
98+
.rev()
9899
.zip(type_param_defs.rev_iter())
99100
.map(|(ty, def)|
100101
lookup_vtables_for_param(vcx, span, Some(substs),

0 commit comments

Comments
 (0)