Skip to content

Commit 7ccd8db

Browse files
author
Jorge Aparicio
committed
---
yaml --- r: 169335 b: refs/heads/master c: ca17d08 h: refs/heads/master i: 169333: 94781fe 169331: 1802d35 169327: 85309da v: v3
1 parent 3a18f4e commit 7ccd8db

File tree

105 files changed

+213
-415
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+213
-415
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: 8d0d7521d65eff290183e9d19858c6ca8779fe01
2+
refs/heads/master: ca17d0812686012307e364a4dce7b84af6886f91
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 5b3cd3900ceda838f5798c30ab96ceb41f962534
55
refs/heads/try: 5204084bd2e46af7cc6e0147430e44dd0d657bbb

trunk/src/test/auxiliary/cci_impl_lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
#![crate_name="cci_impl_lib"]
1212

1313
pub trait uint_helpers {
14-
fn to(&self, v: uint, f: |uint|);
14+
fn to<F>(&self, v: uint, f: F) where F: FnMut(uint);
1515
}
1616

1717
impl uint_helpers for uint {
1818
#[inline]
19-
fn to(&self, v: uint, f: |uint|) {
19+
fn to<F>(&self, v: uint, mut f: F) where F: FnMut(uint) {
2020
let mut i = *self;
2121
while i < v {
2222
f(i);

trunk/src/test/auxiliary/cci_iter_lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#![crate_name="cci_iter_lib"]
1212

1313
#[inline]
14-
pub fn iter<T>(v: &[T], f: |&T|) {
14+
pub fn iter<T, F>(v: &[T], mut f: F) where F: FnMut(&T) {
1515
let mut i = 0u;
1616
let n = v.len();
1717
while i < n {

trunk/src/test/auxiliary/cci_no_inline_lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313

1414
// same as cci_iter_lib, more-or-less, but not marked inline
15-
pub fn iter(v: Vec<uint> , f: |uint|) {
15+
pub fn iter<F>(v: Vec<uint> , mut f: F) where F: FnMut(uint) {
1616
let mut i = 0u;
1717
let n = v.len();
1818
while i < n {

trunk/src/test/auxiliary/iss.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212

1313
// part of issue-6919.rs
1414

15-
pub struct C<'a> {
16-
pub k: ||: 'a,
15+
pub struct C<K> where K: FnOnce() {
16+
pub k: K,
1717
}
1818

1919
fn no_op() { }
20-
pub const D : C<'static> = C {
21-
k: no_op
20+
pub const D : C<fn()> = C {
21+
k: no_op as fn()
2222
};
2323

trunk/src/test/auxiliary/issue13507.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ pub mod testtypes {
2121
ids.push(TypeId::of::<FooEnum>());
2222
ids.push(TypeId::of::<FooUniq>());
2323
ids.push(TypeId::of::<FooPtr>());
24-
ids.push(TypeId::of::<FooClosure>());
2524
ids.push(TypeId::of::<&'static FooTrait>());
2625
ids.push(TypeId::of::<FooStruct>());
2726
ids.push(TypeId::of::<FooTuple>());
@@ -68,9 +67,6 @@ pub mod testtypes {
6867

6968
// Skipping ty_bare_fn (how do you get a bare function type, rather than proc or closure?)
7069

71-
// Tests ty_closure (does not test all types of closures)
72-
pub type FooClosure = |arg: u8|: 'static -> u8;
73-
7470
// Tests ty_trait
7571
pub trait FooTrait {
7672
fn foo_method(&self) -> uint;

trunk/src/test/auxiliary/logging_right_crate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313

1414
pub fn foo<T>() {
1515
fn death() -> int { panic!() }
16-
debug!("{}", (||{ death() })());
16+
debug!("{}", (|&:|{ death() })());
1717
}

trunk/src/test/run-pass/argument-passing.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ fn f1(a: &mut X, b: &mut int, c: int) -> int {
2020
return r;
2121
}
2222

23-
fn f2(a: int, f: |int|) -> int { f(1); return a; }
23+
fn f2<F>(a: int, f: F) -> int where F: FnOnce(int) { f(1); return a; }
2424

2525
pub fn main() {
2626
let mut a = X {x: 1};

trunk/src/test/run-pass/autobind.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111

1212
fn f<T>(x: Vec<T>) -> T { return x.into_iter().next().unwrap(); }
1313

14-
fn g(act: |Vec<int> | -> int) -> int { return act(vec!(1, 2, 3)); }
14+
fn g<F>(act: F) -> int where F: FnOnce(Vec<int>) -> int { return act(vec!(1, 2, 3)); }
1515

1616
pub fn main() {
1717
assert_eq!(g(f), 1);
18-
let f1: |Vec<String>| -> String = f;
18+
let f1 = f;
1919
assert_eq!(f1(vec!["x".to_string(), "y".to_string(), "z".to_string()]),
2020
"x".to_string());
2121
}

trunk/src/test/run-pass/block-arg-call-as.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
fn asBlock(f: || -> uint) -> uint {
11+
fn asBlock<F>(f: F) -> uint where F: FnOnce() -> uint {
1212
return f();
1313
}
1414

trunk/src/test/run-pass/block-explicit-types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
// except according to those terms.
1010

1111
pub fn main() {
12-
fn as_buf<T>(s: String, f: |String| -> T) -> T { f(s) }
12+
fn as_buf<T, F>(s: String, f: F) -> T where F: FnOnce(String) -> T { f(s) }
1313
as_buf("foo".to_string(), |foo: String| -> () println!("{}", foo) );
1414
}

trunk/src/test/run-pass/block-fn-coerce.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
fn force(f: || -> int) -> int { return f(); }
11+
fn force<F>(f: F) -> int where F: FnOnce() -> int { return f(); }
12+
1213
pub fn main() {
1314
fn f() -> int { return 7; }
1415
assert_eq!(force(f), 7);
15-
let g = {||force(f)};
16+
let g = {|&:|force(f)};
1617
assert_eq!(g(), 7);
1718
}

trunk/src/test/run-pass/block-iter-1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
fn iter_vec<T>(v: Vec<T> , f: |&T|) { for x in v.iter() { f(x); } }
11+
fn iter_vec<T, F>(v: Vec<T> , mut f: F) where F: FnMut(&T) { for x in v.iter() { f(x); } }
1212

1313
pub fn main() {
1414
let v = vec!(1i, 2, 3, 4, 5, 6, 7);

trunk/src/test/run-pass/block-iter-2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
fn iter_vec<T>(v: Vec<T> , f: |&T|) { for x in v.iter() { f(x); } }
11+
fn iter_vec<T, F>(v: Vec<T>, mut f: F) where F: FnMut(&T) { for x in v.iter() { f(x); } }
1212

1313
pub fn main() {
1414
let v = vec!(1i, 2, 3, 4, 5);

trunk/src/test/run-pass/borrowck-borrow-from-expr-block.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111

12-
fn borrow(x: &int, f: |x: &int|) {
12+
fn borrow<F>(x: &int, f: F) where F: FnOnce(&int) {
1313
f(x)
1414
}
1515

trunk/src/test/run-pass/borrowck-closures-two-imm.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
// the closures are in scope. Issue #6801.
1616

1717
fn a() -> int {
18-
let mut x = 3;
18+
let mut x = 3i;
1919
x += 1;
20-
let c1 = || x * 4;
21-
let c2 = || x * 5;
20+
let c1 = |&:| x * 4;
21+
let c2 = |&:| x * 5;
2222
c1() * c2() * x
2323
}
2424

@@ -29,16 +29,16 @@ fn get(x: &int) -> int {
2929
fn b() -> int {
3030
let mut x = 3;
3131
x += 1;
32-
let c1 = || get(&x);
33-
let c2 = || get(&x);
32+
let c1 = |&:| get(&x);
33+
let c2 = |&:| get(&x);
3434
c1() * c2() * x
3535
}
3636

3737
fn c() -> int {
3838
let mut x = 3;
3939
x += 1;
40-
let c1 = || x * 5;
41-
let c2 = || get(&x);
40+
let c1 = |&:| x * 5;
41+
let c2 = |&:| get(&x);
4242
c1() * c2() * x
4343
}
4444

trunk/src/test/run-pass/borrowck-mut-uniq.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ fn add_int(x: &mut Ints, v: int) {
2121
swap(&mut values, &mut x.values);
2222
}
2323

24-
fn iter_ints(x: &Ints, f: |x: &int| -> bool) -> bool {
24+
fn iter_ints<F>(x: &Ints, mut f: F) -> bool where F: FnMut(&int) -> bool {
2525
let l = x.values.len();
2626
range(0u, l).all(|i| f(&x.values[i]))
2727
}

trunk/src/test/run-pass/call-closure-from-overloaded-op.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// ignore-test FIXME(japaric) this ICEs
1112

1213
fn foo() -> int { 22 }
1314

trunk/src/test/run-pass/capture-clauses-boxed-closures.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
fn each<T>(x: &[T], f: |&T|) {
11+
fn each<T, F>(x: &[T], mut f: F) where F: FnMut(&T) {
1212
for val in x.iter() {
1313
f(val)
1414
}

trunk/src/test/run-pass/closure-inference.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111

1212
fn foo(i: int) -> int { i + 1 }
1313

14-
fn apply<A>(f: |A| -> A, v: A) -> A { f(v) }
14+
fn apply<A, F>(f: F, v: A) -> A where F: FnOnce(A) -> A { f(v) }
1515

1616
pub fn main() {
17-
let f = {|i| foo(i)};
17+
let f = {|: i| foo(i)};
1818
assert_eq!(apply(f, 2), 3);
1919
}

trunk/src/test/run-pass/closure-inference2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// Test a rather underspecified example:
1212

1313
pub fn main() {
14-
let f = {|i| i};
14+
let f = {|&: i| i};
1515
assert_eq!(f(2i), 2i);
1616
assert_eq!(f(5i), 5i);
1717
}

trunk/src/test/run-pass/closure-reform.rs

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -22,25 +22,14 @@ fn call_it<F>(f: F)
2222
println!("{}", f("Fred".to_string()))
2323
}
2424

25-
fn call_a_thunk(f: ||) {
25+
fn call_a_thunk<F>(f: F) where F: FnOnce() {
2626
f();
2727
}
2828

29-
fn call_this(f: |&str|:Send) {
29+
fn call_this<F>(f: F) where F: FnOnce(&str) + Send {
3030
f("Hello!");
3131
}
3232

33-
fn call_that(f: <'a>|&'a int, &'a int| -> int) {
34-
let (ten, forty_two) = (10, 42);
35-
println!("Your lucky number is {}", f(&ten, &forty_two));
36-
}
37-
38-
fn call_cramped(f:||->uint,g:<'a>||->&'a uint) {
39-
let number = f();
40-
let other_number = *g();
41-
println!("Ticket {} wins an all-expenses-paid trip to Mountain View", number + other_number);
42-
}
43-
4433
fn call_bare(f: fn(&str)) {
4534
f("Hello world!")
4635
}
@@ -71,16 +60,6 @@ pub fn main() {
7160

7261
call_this(|s| println!("{}", s));
7362

74-
call_that(|x, y| *x + *y);
75-
76-
let z = 100;
77-
call_that(|x, y| *x + *y - z);
78-
79-
call_cramped(|| 1, || unsafe {
80-
static a: uint = 100;
81-
mem::transmute(&a)
82-
});
83-
8463
// External functions
8564

8665
call_bare(println);

trunk/src/test/run-pass/closure-return-bang.rs

Lines changed: 0 additions & 20 deletions
This file was deleted.

trunk/src/test/run-pass/closure-syntax.rs

Lines changed: 0 additions & 79 deletions
This file was deleted.

0 commit comments

Comments
 (0)