diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-05-14 22:00:22 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-05-14 22:00:22 +0200 |
| commit | b24981a4fe966e6348e556cf6360ded269d3d093 (patch) | |
| tree | 0b0f8792c7d4ee62c1839aa946eaef59a67eca3b /src/test | |
| parent | 29f93ad5072df54fad1009263ca4bfa9c6f911f3 (diff) | |
| parent | 36fd00e81cd4af2c83839f0c0b96dc20663710c5 (diff) | |
| download | rust-b24981a4fe966e6348e556cf6360ded269d3d093.tar.gz rust-b24981a4fe966e6348e556cf6360ded269d3d093.zip | |
Rollup merge of #60799 - matthewjasper:allow-bound-regions-in-existential-types, r=oli-obk
Allow late-bound regions in existential types closes #60655 r? @oli-obk
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/existential_types/issue-60655-latebound-regions.rs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/test/ui/existential_types/issue-60655-latebound-regions.rs b/src/test/ui/existential_types/issue-60655-latebound-regions.rs new file mode 100644 index 00000000000..a4fe8650129 --- /dev/null +++ b/src/test/ui/existential_types/issue-60655-latebound-regions.rs @@ -0,0 +1,30 @@ +// Test that existential types are allowed to contain late-bound regions. + +// compile-pass +// edition:2018 + +#![feature(async_await, existential_type)] + +use std::future::Future; + +pub existential type Func: Sized; + +// Late bound region should be allowed to escape the function, since it's bound +// in the type. +fn null_function_ptr() -> Func { + None::<for<'a> fn(&'a ())> +} + +async fn async_nop(_: &u8) {} + +pub existential type ServeFut: Future<Output=()>; + +// Late bound regions occur in the generator witness type here. +fn serve() -> ServeFut { + async move { + let x = 5; + async_nop(&x).await + } +} + +fn main() {} |
