Skip to content

Commit 84e98f4

Browse files
committed
Add a test for higher-order bare functions
Issue #1022
1 parent 145feb3 commit 84e98f4

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/test/run-pass/fn-bare-assign.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
fn# f(i: int, &called: bool) {
2+
assert i == 10;
3+
called = true;
4+
}
5+
6+
fn# g(f: fn#(int, &bool), &called: bool) {
7+
f(10, called);
8+
}
9+
10+
fn main() {
11+
let called = false;
12+
let h = f;
13+
g(h, called);
14+
assert called == true;
15+
}

0 commit comments

Comments
 (0)