Skip to content

Commit 57e5e2e

Browse files
committed
Move test to /closures folder, add new test for non-cap closure <-> FnPtr checking.
1 parent a3805db commit 57e5e2e

7 files changed

+19
-0
lines changed

src/test/ui/closures/issue-46742-4.rs

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// check-pass
2+
fn foo(x: i32) -> i32 {
3+
x
4+
}
5+
fn main() {
6+
// We still can coerce non-capturing closure to function pointer
7+
let _ = if true {
8+
foo as fn(i32) -> i32
9+
} else {
10+
|x: i32| x
11+
};
12+
13+
// We still can coerce function pointer to non-capturing closure
14+
let _ = if true {
15+
|x: i32| x
16+
} else {
17+
foo as fn(i32) -> i32
18+
};
19+
}

0 commit comments

Comments
 (0)