mirror of
https://github.com/rust-lang/rust.git
synced 2025-11-01 13:34:38 +00:00
Change description from compiletest to regression test Co-authored-by: 许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com> Improve test name, location, and description Update tests/ui/impl-trait/impl-fn-rpit-opaque-107883.rs Co-authored-by: waffle <waffle.lapkin@gmail.com>
38 lines
648 B
Rust
38 lines
648 B
Rust
//@ check-pass
|
|
// Regression test for <https;//github.com/rust-lang/rust/issues/107883>
|
|
#![feature(impl_trait_in_fn_trait_return)]
|
|
#![feature(unboxed_closures)] // only for `h`
|
|
|
|
use std::fmt::Debug;
|
|
|
|
fn f<T>() -> impl Fn(T) -> impl Debug {
|
|
|_x| 15
|
|
}
|
|
|
|
fn g<T>() -> impl MyFn<(T,), Out = impl Debug> {
|
|
|_x| 15
|
|
}
|
|
|
|
trait MyFn<T> {
|
|
type Out;
|
|
}
|
|
|
|
impl<T, U, F: Fn(T) -> U> MyFn<(T,)> for F {
|
|
type Out = U;
|
|
}
|
|
|
|
fn h<T>() -> impl Fn<(T,), Output = impl Debug> {
|
|
|_x| 15
|
|
}
|
|
|
|
fn f_<T>() -> impl Fn(T) -> impl Debug {
|
|
std::convert::identity(|_x| 15)
|
|
}
|
|
|
|
fn f__<T>() -> impl Fn(T) -> impl Debug {
|
|
let r = |_x| 15;
|
|
r
|
|
}
|
|
|
|
fn main() {}
|