]> git.lizzy.rs Git - rust.git/blob - src/test/ui/impl-trait/impl_fn_associativity.rs
Rollup merge of #105555 - krasimirgg:llvm-int-opt-2, r=cuviper
[rust.git] / src / test / ui / impl-trait / impl_fn_associativity.rs
1 // run-pass
2 #![feature(impl_trait_in_fn_trait_return)]
3 use std::fmt::Debug;
4
5 fn f_debug() -> impl Fn() -> impl Debug {
6     || ()
7 }
8
9 fn ff_debug() -> impl Fn() -> impl Fn() -> impl Debug {
10     || f_debug()
11 }
12
13 fn multi() -> impl Fn() -> (impl Debug + Send) {
14     || ()
15 }
16
17 fn main() {
18     // Check that `ff_debug` is `() -> (() -> Debug)` and not `(() -> ()) -> Debug`
19     let debug = ff_debug()()();
20     assert_eq!(format!("{:?}", debug), "()");
21
22     let x = multi()();
23     assert_eq!(format!("{:?}", x), "()");
24     fn assert_send(_: &impl Send) {}
25     assert_send(&x);
26 }