From 698f8c2f01ea549d77d7dc3338a12e04c11057b9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:02:58 +0200 Subject: Adding upstream version 1.64.0+dfsg1. Signed-off-by: Daniel Baumann --- .../issues/issue-60655-latebound-regions.rs | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/test/ui/async-await/issues/issue-60655-latebound-regions.rs (limited to 'src/test/ui/async-await/issues/issue-60655-latebound-regions.rs') diff --git a/src/test/ui/async-await/issues/issue-60655-latebound-regions.rs b/src/test/ui/async-await/issues/issue-60655-latebound-regions.rs new file mode 100644 index 000000000..66a3b07c3 --- /dev/null +++ b/src/test/ui/async-await/issues/issue-60655-latebound-regions.rs @@ -0,0 +1,30 @@ +// Test that opaque `impl Trait` types are allowed to contain late-bound regions. + +// check-pass +// edition:2018 + +#![feature(type_alias_impl_trait)] + +use std::future::Future; + +pub type Func = impl Sized; + +// Late bound region should be allowed to escape the function, since it's bound +// in the type. +fn null_function_ptr() -> Func { + None:: fn(&'a ())> +} + +async fn async_nop(_: &u8) {} + +pub type ServeFut = impl Future; + +// Late bound regions occur in the generator witness type here. +fn serve() -> ServeFut { + async move { + let x = 5; + async_nop(&x).await + } +} + +fn main() {} -- cgit v1.2.3