forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#60799 - matthewjasper:allow-bound-regions-i…
…n-existential-types, r=oli-obk Allow late-bound regions in existential types closes rust-lang#60655 r? @oli-obk
- Loading branch information
Showing
2 changed files
with
35 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/test/ui/existential_types/issue-60655-latebound-regions.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() {} |