Skip to content

Commit 042bab8

Browse files
committed
auto merge of #10572 : pcwalton/rust/more-bars, r=alexcrichton
r? @alexcrichton
2 parents c159acb + 2049016 commit 042bab8

File tree

145 files changed

+249
-256
lines changed

Some content is hidden

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

145 files changed

+249
-256
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
#[link(name="cci_impl_lib", vers="0.0")];
1212

1313
trait uint_helpers {
14-
fn to(&self, v: uint, f: &fn(uint));
14+
fn to(&self, v: uint, f: |uint|);
1515
}
1616

1717
impl uint_helpers for uint {
1818
#[inline]
19-
fn to(&self, v: uint, f: &fn(uint)) {
19+
fn to(&self, v: uint, f: |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
#[link(name="cci_iter_lib", vers="0.0")];
1212

1313
#[inline]
14-
pub fn iter<T>(v: &[T], f: &fn(&T)) {
14+
pub fn iter<T>(v: &[T], f: |&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
@@ -11,7 +11,7 @@
1111
#[link(name="cci_no_inline_lib", vers="0.0")];
1212

1313
// same as cci_iter_lib, more-or-less, but not marked inline
14-
pub fn iter(v: ~[uint], f: &fn(uint)) {
14+
pub fn iter(v: ~[uint], f: |uint|) {
1515
let mut i = 0u;
1616
let n = v.len();
1717
while i < n {

src/test/bench/core-map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use std::trie::TrieMap;
1919
use std::uint;
2020
use std::vec;
2121

22-
fn timed(label: &str, f: &fn()) {
22+
fn timed(label: &str, f: ||) {
2323
let start = time::precise_time_s();
2424
f();
2525
let end = time::precise_time_s();

src/test/bench/core-set.rs

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ struct Results {
2727
delete_strings: f64
2828
}
2929

30-
fn timed(result: &mut f64, op: &fn()) {
30+
fn timed(result: &mut f64, op: ||) {
3131
let start = extra::time::precise_time_s();
3232
op();
3333
let end = extra::time::precise_time_s();
@@ -36,13 +36,12 @@ fn timed(result: &mut f64, op: &fn()) {
3636

3737
impl Results {
3838
pub fn bench_int<T:MutableSet<uint>,
39-
R: rand::Rng>(
40-
&mut self,
41-
rng: &mut R,
42-
num_keys: uint,
43-
rand_cap: uint,
44-
f: &fn() -> T) {
45-
{
39+
R: rand::Rng>(
40+
&mut self,
41+
rng: &mut R,
42+
num_keys: uint,
43+
rand_cap: uint,
44+
f: || -> T) { {
4645
let mut set = f();
4746
do timed(&mut self.sequential_ints) {
4847
for i in range(0u, num_keys) {
@@ -79,11 +78,11 @@ impl Results {
7978
}
8079

8180
pub fn bench_str<T:MutableSet<~str>,
82-
R:rand::Rng>(
83-
&mut self,
84-
rng: &mut R,
85-
num_keys: uint,
86-
f: &fn() -> T) {
81+
R:rand::Rng>(
82+
&mut self,
83+
rng: &mut R,
84+
num_keys: uint,
85+
f: || -> T) {
8786
{
8887
let mut set = f();
8988
do timed(&mut self.sequential_strings) {

src/test/bench/core-std.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ fn main() {
4040
bench!(argv, is_utf8_multibyte);
4141
}
4242

43-
fn maybe_run_test(argv: &[~str], name: ~str, test: &fn()) {
43+
fn maybe_run_test(argv: &[~str], name: ~str, test: ||) {
4444
let mut run_test = false;
4545

4646
if os::getenv("RUST_BENCH").is_some() {

src/test/bench/shootout-k-nucleotide-pipes.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,7 @@ fn update_freq(mm: &mut HashMap<~[u8], uint>, key: &[u8]) {
104104
// given a ~[u8], for each window call a function
105105
// i.e., for "hello" and windows of size four,
106106
// run it("hell") and it("ello"), then return "llo"
107-
fn windows_with_carry(bb: &[u8], nn: uint,
108-
it: &fn(window: &[u8])) -> ~[u8] {
107+
fn windows_with_carry(bb: &[u8], nn: uint, it: |window: &[u8]|) -> ~[u8] {
109108
let mut ii = 0u;
110109

111110
let len = bb.len();

src/test/bench/shootout-k-nucleotide.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ impl Table {
154154
}
155155
}
156156

157-
fn each(&self, f: &fn(entry: &Entry) -> bool) {
157+
fn each(&self, f: |entry: &Entry| -> bool) {
158158
for self.items.each |item| {
159159
match *item {
160160
None => {}

src/test/compile-fail/access-mode-in-closures.rs

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

1212
struct sty(~[int]);
1313

14-
fn unpack(_unpack: &fn(v: &sty) -> ~[int]) {}
14+
fn unpack(_unpack: |v: &sty| -> ~[int]) {}
1515

1616
fn main() {
1717
let _foo = unpack(|s| {

src/test/compile-fail/block-coerce-no-2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ fn main() {
1515
fn f(f: extern fn(extern fn(extern fn()))) {
1616
}
1717

18-
fn g(f: extern fn(&fn())) {
18+
fn g(f: extern fn(||)) {
1919
}
2020

2121
f(g);

src/test/compile-fail/block-coerce-no.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
// Make sure that fn-to-block coercion isn't incorrectly lifted over
1212
// other tycons.
1313

14-
fn coerce(b: &fn()) -> extern fn() {
15-
fn lol(f: extern fn(v: &fn()) -> extern fn(),
16-
g: &fn()) -> extern fn() { return f(g); }
14+
fn coerce(b: ||) -> extern fn() {
15+
fn lol(f: extern fn(v: ||) -> extern fn(),
16+
g: ||) -> extern fn() { return f(g); }
1717
fn fn_id(f: extern fn()) -> extern fn() { return f }
1818
return lol(fn_id, b);
1919
//~^ ERROR mismatched types

src/test/compile-fail/borrowck-assign-comp-idx.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ fn a() {
2424
info!("{}", *q);
2525
}
2626

27-
fn borrow(_x: &[int], _f: &fn()) {}
27+
fn borrow(_x: &[int], _f: ||) {}
2828

2929
fn b() {
3030
// here we alias the mutable vector into an imm slice and try to

src/test/compile-fail/borrowck-autoref-3261.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
struct X(Either<(uint,uint),extern fn()>);
1212

1313
impl X {
14-
pub fn with(&self, blk: &fn(x: &Either<(uint,uint),extern fn()>)) {
14+
pub fn with(&self, blk: |x: &Either<(uint,uint),extern fn()>|) {
1515
blk(&**self)
1616
}
1717
}

src/test/compile-fail/borrowck-insert-during-each.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ struct Foo {
1515
}
1616

1717
impl Foo {
18-
pub fn foo(&mut self, fun: &fn(&int)) {
18+
pub fn foo(&mut self, fun: |&int|) {
1919
for f in self.n.iter() {
2020
fun(f);
2121
}

src/test/compile-fail/borrowck-lend-flow-if.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
fn borrow(_v: &int) {}
1818
fn borrow_mut(_v: &mut int) {}
1919
fn cond() -> bool { fail!() }
20-
fn for_func(_f: &fn() -> bool) { fail!() }
20+
fn for_func(_f: || -> bool) { fail!() }
2121
fn produce<T>() -> T { fail!(); }
2222

2323
fn inc(v: &mut ~int) {

src/test/compile-fail/borrowck-lend-flow-loop.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ fn while_aliased_mut_cond(cond: bool, cond2: bool) {
111111
}
112112
}
113113

114-
fn loop_break_pops_scopes<'r>(_v: &'r mut [uint], f: &fn(&'r mut uint) -> bool) {
114+
fn loop_break_pops_scopes<'r>(_v: &'r mut [uint], f: |&'r mut uint| -> bool) {
115115
// Here we check that when you break out of an inner loop, the
116116
// borrows that go out of scope as you exit the inner loop are
117117
// removed from the bitset.
@@ -127,7 +127,7 @@ fn loop_break_pops_scopes<'r>(_v: &'r mut [uint], f: &fn(&'r mut uint) -> bool)
127127
}
128128
}
129129

130-
fn loop_loop_pops_scopes<'r>(_v: &'r mut [uint], f: &fn(&'r mut uint) -> bool) {
130+
fn loop_loop_pops_scopes<'r>(_v: &'r mut [uint], f: |&'r mut uint| -> bool) {
131131
// Similar to `loop_break_pops_scopes` but for the `loop` keyword
132132

133133
while cond() {

src/test/compile-fail/borrowck-lend-flow.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
fn borrow(_v: &int) {}
1818
fn borrow_mut(_v: &mut int) {}
1919
fn cond() -> bool { fail!() }
20-
fn for_func(_f: &fn() -> bool) { fail!() }
20+
fn for_func(_f: || -> bool) { fail!() }
2121
fn produce<T>() -> T { fail!(); }
2222

2323
fn inc(v: &mut ~int) {

src/test/compile-fail/borrowck-loan-blocks-move-cc.rs

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

1111
use std::task;
1212

13-
fn borrow(v: &int, f: &fn(x: &int)) {
13+
fn borrow(v: &int, f: |x: &int|) {
1414
f(v);
1515
}
1616

src/test/compile-fail/borrowck-loan-blocks-mut-uniq.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 borrow(v: &int, f: &fn(x: &int)) {
11+
fn borrow(v: &int, f: |x: &int|) {
1212
f(v);
1313
}
1414

src/test/compile-fail/borrowck-loan-rcvr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ struct point { x: int, y: int }
1212

1313
trait methods {
1414
fn impurem(&self);
15-
fn blockm(&self, f: &fn());
15+
fn blockm(&self, f: ||);
1616
}
1717

1818
impl methods for point {
1919
fn impurem(&self) {
2020
}
2121

22-
fn blockm(&self, f: &fn()) { f() }
22+
fn blockm(&self, f: ||) { f() }
2323
}
2424

2525
fn a() {

src/test/compile-fail/borrowck-loan-vec-content.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// (locally rooted) mutable, unique vector, and that we then prevent
1313
// modifications to the contents.
1414

15-
fn takes_imm_elt(_v: &int, f: &fn()) {
15+
fn takes_imm_elt(_v: &int, f: ||) {
1616
f();
1717
}
1818

src/test/compile-fail/borrowck-move-in-irrefut-pat.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
fn with(f: &fn(&~str)) {}
1+
fn with(f: |&~str|) {}
22

33
fn arg_item(&_x: &~str) {}
44
//~^ ERROR cannot move out of dereference of & pointer

src/test/compile-fail/closure-bounds-not-builtin.rs

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

22
trait Foo {}
33

4-
fn take(f: &fn:Foo()) {
4+
fn take(f: ||:Foo) {
55
//~^ ERROR only the builtin traits can be used as closure or object bounds
66
}
77

src/test/compile-fail/closure-bounds-static-cant-capture-borrowed.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 bar(blk: &fn:'static()) {
11+
fn bar(blk: ||:'static) {
1212
}
1313

1414
fn foo(x: &()) {

src/test/compile-fail/closure-bounds-subtype.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11

2-
fn take_any(_: &fn:()) {
2+
fn take_any(_: ||:) {
33
}
44

5-
fn take_const_owned(_: &fn:Freeze+Send()) {
5+
fn take_const_owned(_: ||:Freeze+Send) {
66
}
77

8-
fn give_any(f: &fn:()) {
8+
fn give_any(f: ||:) {
99
take_any(f);
1010
}
1111

12-
fn give_owned(f: &fn:Send()) {
12+
fn give_owned(f: ||:Send) {
1313
take_any(f);
1414
take_const_owned(f); //~ ERROR expected bounds `Send+Freeze` but found bounds `Send`
1515
}

src/test/compile-fail/closure-that-fails.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
fn foo(f: &fn() -> !) {}
1+
fn foo(f: || -> !) {}
22

33
fn main() {
44
// Type inference didn't use to be able to handle this:

src/test/compile-fail/do2.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 f(f: &fn(int) -> bool) -> bool { f(10i) }
11+
fn f(f: |int| -> bool) -> bool { f(10i) }
1212

1313
fn main() {
1414
assert!(do f() |i| { i == 10i } == 10i);

src/test/compile-fail/extern-wrong-value-type.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ extern fn f() {
1414
fn main() {
1515
// extern functions are extern "C" fn
1616
let _x: extern "C" fn() = f; // OK
17-
let _x: &fn() = f; //~ ERROR mismatched types
17+
let _x: || = f; //~ ERROR mismatched types
1818
}

src/test/compile-fail/fn-variance-1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
fn takes_mut(x: @mut int) { }
1414
fn takes_imm(x: @int) { }
1515

16-
fn apply<T>(t: T, f: &fn(T)) {
16+
fn apply<T>(t: T, f: |T|) {
1717
f(t)
1818
}
1919

src/test/compile-fail/immut-function-arguments.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ fn f(y: ~int) {
1313
}
1414

1515
fn g() {
16-
let _frob: &fn(~int) = |q| { *q = 2; }; //~ ERROR cannot assign
16+
let _frob: |~int| = |q| { *q = 2; }; //~ ERROR cannot assign
1717

1818
}
1919

src/test/compile-fail/issue-2074.rs

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

1111
// xfail-test
1212
fn main() {
13-
let one: &fn() -> uint = || {
13+
let one: || -> uint = || {
1414
enum r { a };
1515
a as uint
1616
};
17-
let two = &fn() -> uint = || {
17+
let two = || -> uint = || {
1818
enum r { a };
1919
a as uint
2020
};

src/test/compile-fail/issue-2149.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
// except according to those terms.
1010

1111
trait vec_monad<A> {
12-
fn bind<B>(&self, f: &fn(A) -> ~[B]);
12+
fn bind<B>(&self, f: |A| -> ~[B]);
1313
}
1414

1515
impl<A> vec_monad<A> for ~[A] {
16-
fn bind<B>(&self, f: &fn(A) -> ~[B]) {
16+
fn bind<B>(&self, f: |A| -> ~[B]) {
1717
let mut r = fail!();
1818
for elt in self.iter() { r = r + f(*elt); }
1919
//~^ ERROR the type of this value must be known

src/test/compile-fail/issue-5216.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
// except according to those terms.
1010

1111
fn f() { }
12-
struct S(&fn()); //~ ERROR missing lifetime specifier
12+
struct S(||); //~ ERROR missing lifetime specifier
1313
pub static C: S = S(f);
1414

1515

1616
fn g() { }
17-
type T = &fn(); //~ ERROR missing lifetime specifier
17+
type T = ||; //~ ERROR missing lifetime specifier
1818
pub static D: T = g;
1919

2020
fn main() {}

src/test/compile-fail/issue-5239-1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
// Regression test for issue #5239
1212

1313
fn main() {
14-
let x: &fn(int) -> int = |ref x| { x += 1; }; //~ ERROR binary operation + cannot be applied to type `&int`
14+
let x: |int| -> int = |ref x| { x += 1; }; //~ ERROR binary operation + cannot be applied to type `&int`
1515
}

0 commit comments

Comments
 (0)