]> git.lizzy.rs Git - rust.git/blob - src/test/ui/async-await/issues/issue-60655-latebound-regions.rs
Rollup merge of #103766 - lukas-code:error-in-core, r=Dylan-DPC
[rust.git] / src / test / ui / async-await / issues / issue-60655-latebound-regions.rs
1 // Test that opaque `impl Trait` types are allowed to contain late-bound regions.
2
3 // check-pass
4 // edition:2018
5
6 #![feature(type_alias_impl_trait)]
7
8 use std::future::Future;
9
10 pub type Func = impl Sized;
11
12 // Late bound region should be allowed to escape the function, since it's bound
13 // in the type.
14 fn null_function_ptr() -> Func {
15     None::<for<'a> fn(&'a ())>
16 }
17
18 async fn async_nop(_: &u8) {}
19
20 pub type ServeFut = impl Future<Output=()>;
21
22 // Late bound regions occur in the generator witness type here.
23 fn serve() -> ServeFut {
24     async move {
25         let x = 5;
26         async_nop(&x).await
27     }
28 }
29
30 fn main() {}