Skip to content

Commit 9a861a1

Browse files
committed
---
yaml --- r: 24284 b: refs/heads/master c: fec96b2 h: refs/heads/master v: v3
1 parent b9ad779 commit 9a861a1

File tree

16 files changed

+58
-58
lines changed

16 files changed

+58
-58
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: f7e90fca6e9a9e262225571a5d6a4e010ca82849
2+
refs/heads/master: fec96b2ae0f387488f718390eee4c67a043d9a9b
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
55
refs/heads/try: ffbe0e0e00374358b789b0037bcb3a577cd218be

trunk/src/libcore/iter-trait.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ impl<A> IMPL_T<A>: iter::BaseIter<A> {
1414

1515
impl<A> IMPL_T<A>: iter::ExtendedIter<A> {
1616
pure fn eachi(blk: fn(uint, v: &A) -> bool) { iter::eachi(&self, blk) }
17-
pure fn all(blk: fn(A) -> bool) -> bool { iter::all(self, blk) }
18-
pure fn any(blk: fn(A) -> bool) -> bool { iter::any(self, blk) }
17+
pure fn all(blk: fn(&A) -> bool) -> bool { iter::all(&self, blk) }
18+
pure fn any(blk: fn(&A) -> bool) -> bool { iter::any(&self, blk) }
1919
pure fn foldl<B>(+b0: B, blk: fn(B, A) -> B) -> B {
2020
iter::foldl(self, move b0, blk)
2121
}
@@ -30,18 +30,18 @@ impl<A: Eq> IMPL_T<A>: iter::EqIter<A> {
3030
}
3131

3232
impl<A: Copy> IMPL_T<A>: iter::CopyableIter<A> {
33-
pure fn filter_to_vec(pred: fn(A) -> bool) -> ~[A] {
34-
iter::filter_to_vec(self, pred)
33+
pure fn filter_to_vec(pred: fn(+a: A) -> bool) -> ~[A] {
34+
iter::filter_to_vec(&self, pred)
3535
}
36-
pure fn map_to_vec<B>(op: fn(v: &A) -> B) -> ~[B] {
37-
iter::map_to_vec(self, op)
36+
pure fn map_to_vec<B>(op: fn(+v: A) -> B) -> ~[B] {
37+
iter::map_to_vec(&self, op)
3838
}
3939
pure fn to_vec() -> ~[A] { iter::to_vec(self) }
4040

41-
// FIXME--bug in resolve prevents this from working (#2611)
42-
// fn flat_map_to_vec<B:copy,IB:base_iter<B>>(op: fn(A) -> IB) -> ~[B] {
43-
// iter::flat_map_to_vec(self, op)
44-
// }
41+
pure fn flat_map_to_vec<B:Copy,IB:BaseIter<B>>(op: fn(+a: A) -> IB)
42+
-> ~[B] {
43+
iter::flat_map_to_vec(&self, op)
44+
}
4545

4646
pure fn find(p: fn(A) -> bool) -> Option<A> { iter::find(self, p) }
4747
}

trunk/src/libcore/iter.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ trait BaseIter<A> {
1616

1717
trait ExtendedIter<A> {
1818
pure fn eachi(blk: fn(uint, v: &A) -> bool);
19-
pure fn all(blk: fn(A) -> bool) -> bool;
20-
pure fn any(blk: fn(A) -> bool) -> bool;
19+
pure fn all(blk: fn(&A) -> bool) -> bool;
20+
pure fn any(blk: fn(&A) -> bool) -> bool;
2121
pure fn foldl<B>(+b0: B, blk: fn(B, A) -> B) -> B;
2222
pure fn position(f: fn(A) -> bool) -> Option<uint>;
2323
}
@@ -35,8 +35,8 @@ trait TimesIx{
3535
}
3636

3737
trait CopyableIter<A:Copy> {
38-
pure fn filter_to_vec(pred: fn(A) -> bool) -> ~[A];
39-
pure fn map_to_vec<B>(op: fn(v: &A) -> B) -> ~[B];
38+
pure fn filter_to_vec(pred: fn(+a: A) -> bool) -> ~[A];
39+
pure fn map_to_vec<B>(op: fn(+v: A) -> B) -> ~[B];
4040
pure fn to_vec() -> ~[A];
4141
pure fn find(p: fn(A) -> bool) -> Option<A>;
4242
}
@@ -74,40 +74,40 @@ pure fn eachi<A,IA:BaseIter<A>>(self: &IA, blk: fn(uint, v: &A) -> bool) {
7474
}
7575
}
7676

77-
pure fn all<A,IA:BaseIter<A>>(self: IA, blk: fn(A) -> bool) -> bool {
77+
pure fn all<A,IA:BaseIter<A>>(self: &IA, blk: fn(&A) -> bool) -> bool {
7878
for self.each |a| {
79-
if !blk(*a) { return false; }
79+
if !blk(a) { return false; }
8080
}
8181
return true;
8282
}
8383

84-
pure fn any<A,IA:BaseIter<A>>(self: IA, blk: fn(A) -> bool) -> bool {
84+
pure fn any<A,IA:BaseIter<A>>(self: &IA, blk: fn(&A) -> bool) -> bool {
8585
for self.each |a| {
86-
if blk(*a) { return true; }
86+
if blk(a) { return true; }
8787
}
8888
return false;
8989
}
9090

91-
pure fn filter_to_vec<A:Copy,IA:BaseIter<A>>(self: IA,
92-
prd: fn(A) -> bool) -> ~[A] {
91+
pure fn filter_to_vec<A:Copy,IA:BaseIter<A>>(self: &IA,
92+
prd: fn(+a: A) -> bool) -> ~[A] {
9393
do vec::build_sized_opt(self.size_hint()) |push| {
9494
for self.each |a| {
9595
if prd(*a) { push(*a); }
9696
}
9797
}
9898
}
9999

100-
pure fn map_to_vec<A:Copy,B,IA:BaseIter<A>>(self: IA, op: fn(v: &A) -> B)
100+
pure fn map_to_vec<A:Copy,B,IA:BaseIter<A>>(self: &IA, op: fn(+v: A) -> B)
101101
-> ~[B] {
102102
do vec::build_sized_opt(self.size_hint()) |push| {
103103
for self.each |a| {
104-
push(op(a));
104+
push(op(*a));
105105
}
106106
}
107107
}
108108

109109
pure fn flat_map_to_vec<A:Copy,B:Copy,IA:BaseIter<A>,IB:BaseIter<B>>(
110-
self: IA, op: fn(A) -> IB) -> ~[B] {
110+
self: &IA, op: fn(+a: A) -> IB) -> ~[B] {
111111

112112
do vec::build |push| {
113113
for self.each |a| {

trunk/src/libcore/vec.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1991,8 +1991,8 @@ impl<A> &[A]: iter::BaseIter<A> {
19911991

19921992
impl<A> &[A]: iter::ExtendedIter<A> {
19931993
pure fn eachi(blk: fn(uint, v: &A) -> bool) { iter::eachi(&self, blk) }
1994-
pure fn all(blk: fn(A) -> bool) -> bool { iter::all(self, blk) }
1995-
pure fn any(blk: fn(A) -> bool) -> bool { iter::any(self, blk) }
1994+
pure fn all(blk: fn(&A) -> bool) -> bool { iter::all(&self, blk) }
1995+
pure fn any(blk: fn(&A) -> bool) -> bool { iter::any(&self, blk) }
19961996
pure fn foldl<B>(+b0: B, blk: fn(B, A) -> B) -> B {
19971997
iter::foldl(self, move b0, blk)
19981998
}
@@ -2007,11 +2007,11 @@ impl<A: Eq> &[A]: iter::EqIter<A> {
20072007
}
20082008

20092009
impl<A: Copy> &[A]: iter::CopyableIter<A> {
2010-
pure fn filter_to_vec(pred: fn(A) -> bool) -> ~[A] {
2011-
iter::filter_to_vec(self, pred)
2010+
pure fn filter_to_vec(pred: fn(+a: A) -> bool) -> ~[A] {
2011+
iter::filter_to_vec(&self, pred)
20122012
}
2013-
pure fn map_to_vec<B>(op: fn(v: &A) -> B) -> ~[B] {
2014-
iter::map_to_vec(self, op)
2013+
pure fn map_to_vec<B>(op: fn(+v: A) -> B) -> ~[B] {
2014+
iter::map_to_vec(&self, op)
20152015
}
20162016
pure fn to_vec() -> ~[A] { iter::to_vec(self) }
20172017

trunk/src/libsyntax/ext/pipes/proto.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,10 @@ fn visit<Tproto, Tstate, Tmessage, V: visitor<Tproto, Tstate, Tmessage>>(
210210
// the copy keywords prevent recursive use of dvec
211211
let states = do (copy proto.states).map_to_vec |s| {
212212
let messages = do (copy s.messages).map_to_vec |m| {
213-
let message(name, span, tys, this, next) = *m;
213+
let message(name, span, tys, this, next) = m;
214214
visitor.visit_message(name, span, tys, this, next)
215215
};
216-
visitor.visit_state(*s, messages)
216+
visitor.visit_state(s, messages)
217217
};
218218
visitor.visit_proto(proto, states)
219219
}

trunk/src/rustc/metadata/creader.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ fn warn_if_multiple_versions(e: env, diag: span_handler,
6363
partition(crate_cache.map_to_vec(|entry| {
6464
let othername = loader::crate_name_from_metas(*entry.metas);
6565
if name == othername {
66-
Left(*entry)
66+
Left(entry)
6767
} else {
68-
Right(*entry)
68+
Right(entry)
6969
}
7070
}));
7171

trunk/src/rustc/middle/check_alt.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ fn check_local(tcx: ty::ctxt, loc: @local, &&s: (), v: visit::vt<()>) {
432432
}
433433
}
434434

435-
fn is_refutable(tcx: ty::ctxt, pat: @pat) -> bool {
435+
fn is_refutable(tcx: ty::ctxt, pat: &pat) -> bool {
436436
match tcx.def_map.find(pat.id) {
437437
Some(def_variant(enum_id, _)) => {
438438
if vec::len(*ty::enum_variants(tcx, enum_id)) != 1u {
@@ -457,10 +457,10 @@ fn is_refutable(tcx: ty::ctxt, pat: @pat) -> bool {
457457
fields.any(|f| is_refutable(tcx, f.pat))
458458
}
459459
pat_tup(elts) => {
460-
elts.any(|elt| is_refutable(tcx, elt))
460+
elts.any(|elt| is_refutable(tcx, *elt))
461461
}
462462
pat_enum(_, Some(args)) => {
463-
args.any(|a| is_refutable(tcx, a))
463+
args.any(|a| is_refutable(tcx, *a))
464464
}
465465
pat_enum(_,_) => { false }
466466
}

trunk/src/rustc/middle/lint.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ fn get_lint_dict() -> lint_dict {
149149
(~"deprecated_mode",
150150
@{lint: deprecated_mode,
151151
desc: ~"warn about deprecated uses of modes",
152-
default: allow}),
152+
default: warn}),
153153

154154
(~"deprecated_pattern",
155155
@{lint: deprecated_pattern,

trunk/src/rustc/middle/trans/alt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ fn enter_region(bcx: block, dm: DefMap, m: &[@Match/&r],
514514

515515
fn get_options(ccx: @crate_ctxt, m: &[@Match], col: uint) -> ~[Opt] {
516516
fn add_to_set(tcx: ty::ctxt, set: &DVec<Opt>, val: Opt) {
517-
if set.any(|l| opt_eq(tcx, &l, &val)) {return;}
517+
if set.any(|l| opt_eq(tcx, l, &val)) {return;}
518518
set.push(val);
519519
}
520520

trunk/src/rustc/middle/typeck/check/vtable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use util::common::indenter;
2424
fn has_trait_bounds(tps: ~[ty::param_bounds]) -> bool {
2525
vec::any(tps, |bs| {
2626
bs.any(|b| {
27-
match b { ty::bound_trait(_) => true, _ => false }
27+
match b { &ty::bound_trait(_) => true, _ => false }
2828
})
2929
})
3030
}

trunk/src/test/bench/graph500-bfs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ fn validate(edges: ~[(node_id, node_id)],
352352
log(info, ~"Verifying graph edges...");
353353
354354
let status = do edges.all() |e| {
355-
let (u, v) = e;
355+
let (u, v) = *e;
356356
357357
abs(level[u] - level[v]) <= 1
358358
};

trunk/src/test/run-pass/issue-2611.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
use iter::BaseIter;
55

66
trait FlatMapToVec<A> {
7-
fn flat_map_to_vec<B:Copy, IB:BaseIter<B>>(op: fn(A) -> IB) -> ~[B];
7+
fn flat_map_to_vec<B:Copy, IB:BaseIter<B>>(op: fn(+a: A) -> IB) -> ~[B];
88
}
99

1010
impl<A:Copy> BaseIter<A>: FlatMapToVec<A> {
11-
fn flat_map_to_vec<B:Copy, IB:BaseIter<B>>(op: fn(A) -> IB) -> ~[B] {
12-
iter::flat_map_to_vec(self, op)
11+
fn flat_map_to_vec<B:Copy, IB:BaseIter<B>>(op: fn(+a: A) -> IB) -> ~[B] {
12+
iter::flat_map_to_vec(&self, op)
1313
}
1414
}
1515

trunk/src/test/run-pass/iter-all.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
fn is_even(&&x: uint) -> bool { (x % 2u) == 0u }
1+
fn is_even(x: &uint) -> bool { (*x % 2) == 0 }
22

33
fn main() {
44
assert ![1u, 2u]/_.all(is_even);

trunk/src/test/run-pass/iter-any.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
fn is_even(&&x: uint) -> bool { (x % 2u) == 0u }
1+
fn is_even(x: &uint) -> bool { (*x % 2) == 0 }
22

33
fn main() {
44
assert ![1u, 3u]/_.any(is_even);
55
assert [1u, 2u]/_.any(is_even);
66
assert ![]/_.any(is_even);
77

8-
assert !Some(1u).any(is_even);
9-
assert Some(2u).any(is_even);
8+
assert !Some(1).any(is_even);
9+
assert Some(2).any(is_even);
1010
assert !None.any(is_even);
1111
}
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
fn is_even(&&x: uint) -> bool { (x % 2u) == 0u }
1+
fn is_even(+x: uint) -> bool { (x % 2) == 0 }
22

33
fn main() {
4-
assert [1u, 3u]/_.filter_to_vec(is_even) == ~[];
5-
assert [1u, 2u, 3u]/_.filter_to_vec(is_even) == ~[2u];
4+
assert [1, 3]/_.filter_to_vec(is_even) == ~[];
5+
assert [1, 2, 3]/_.filter_to_vec(is_even) == ~[2];
66
assert None.filter_to_vec(is_even) == ~[];
7-
assert Some(1u).filter_to_vec(is_even) == ~[];
8-
assert Some(2u).filter_to_vec(is_even) == ~[2u];
7+
assert Some(1).filter_to_vec(is_even) == ~[];
8+
assert Some(2).filter_to_vec(is_even) == ~[2];
99
}
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
fn inc(x: &uint) -> uint { *x + 1u }
1+
fn inc(+x: uint) -> uint { x + 1 }
22

33
fn main() {
4-
assert [1u, 3u]/_.map_to_vec(inc) == ~[2u, 4u];
5-
assert [1u, 2u, 3u]/_.map_to_vec(inc) == ~[2u, 3u, 4u];
4+
assert [1, 3]/_.map_to_vec(inc) == ~[2, 4];
5+
assert [1, 2, 3]/_.map_to_vec(inc) == ~[2, 3, 4];
66
assert None.map_to_vec(inc) == ~[];
7-
assert Some(1u).map_to_vec(inc) == ~[2u];
8-
assert Some(2u).map_to_vec(inc) == ~[3u];
7+
assert Some(1).map_to_vec(inc) == ~[2];
8+
assert Some(2).map_to_vec(inc) == ~[3];
99
}

0 commit comments

Comments
 (0)