]> git.lizzy.rs Git - rust.git/blob - src/test/ui/async-await/issues/issue-60655-latebound-regions.rs
Auto merge of #83152 - guswynn:jemallocator_part2, r=Mark-Simulacrum
[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 // revisions: min_tait full_tait
7 #![feature(min_type_alias_impl_trait)]
8 #![cfg_attr(full_tait, feature(type_alias_impl_trait))]
9 //[full_tait]~^ WARN incomplete
10
11 use std::future::Future;
12
13 pub type Func = impl Sized;
14
15 // Late bound region should be allowed to escape the function, since it's bound
16 // in the type.
17 fn null_function_ptr() -> Func {
18     None::<for<'a> fn(&'a ())>
19 }
20
21 async fn async_nop(_: &u8) {}
22
23 pub type ServeFut = impl Future<Output=()>;
24
25 // Late bound regions occur in the generator witness type here.
26 fn serve() -> ServeFut {
27     async move {
28         let x = 5;
29         async_nop(&x).await
30     }
31 }
32
33 fn main() {}