Skip to content

Commit 8c864be

Browse files
authored
Unrolled build for rust-lang#136971
Rollup merge of rust-lang#136971 - HypheX:patch1, r=WaffleLapkin Add a new check-pass UI test for returning `impl Fn(T) -> impl Trait` This PR closes rust-lang#107883 by adding a ui test.
2 parents fc147b4 + 7d1262a commit 8c864be

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
//@ check-pass
2+
// Regression test for <https;//github.com/rust-lang/rust/issues/107883>
3+
#![feature(impl_trait_in_fn_trait_return)]
4+
#![feature(unboxed_closures)] // only for `h`
5+
6+
use std::fmt::Debug;
7+
8+
fn f<T>() -> impl Fn(T) -> impl Debug {
9+
|_x| 15
10+
}
11+
12+
fn g<T>() -> impl MyFn<(T,), Out = impl Debug> {
13+
|_x| 15
14+
}
15+
16+
trait MyFn<T> {
17+
type Out;
18+
}
19+
20+
impl<T, U, F: Fn(T) -> U> MyFn<(T,)> for F {
21+
type Out = U;
22+
}
23+
24+
fn h<T>() -> impl Fn<(T,), Output = impl Debug> {
25+
|_x| 15
26+
}
27+
28+
fn f_<T>() -> impl Fn(T) -> impl Debug {
29+
std::convert::identity(|_x| 15)
30+
}
31+
32+
fn f__<T>() -> impl Fn(T) -> impl Debug {
33+
let r = |_x| 15;
34+
r
35+
}
36+
37+
fn main() {}

0 commit comments

Comments
 (0)