Skip to content

Commit ca17d08

Browse files
author
Jorge Aparicio
committed
fix rpass tests
1 parent 8d0d752 commit ca17d08

File tree

104 files changed

+212
-414
lines changed

Some content is hidden

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

104 files changed

+212
-414
lines changed

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);

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 {

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 {

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

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;

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
}

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};

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
}

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

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
}

0 commit comments

Comments
 (0)