Skip to content

Commit 3ed486b

Browse files
committed
Add test for impl Fn associativity
1 parent 86b2819 commit 3ed486b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// run-pass
2+
use std::fmt::Debug;
3+
4+
fn f_debug() -> impl Fn() -> impl Debug {
5+
|| ()
6+
}
7+
8+
fn ff_debug() -> impl Fn() -> impl Fn() -> impl Debug {
9+
|| f_debug()
10+
}
11+
12+
fn main() {
13+
// Check that `ff_debug` is `() -> (() -> Debug)` and not `(() -> ()) -> Debug`
14+
let debug = ff_debug()()();
15+
assert_eq!(format!("{:?}", debug), "()");
16+
}

0 commit comments

Comments
 (0)