Skip to content

Commit 143e7d5

Browse files
committed
Desugared asyncs into generators and minimised.
1 parent fcec51d commit 143e7d5

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

src/test/run-pass/generator/issue-57084.rs

+13-12
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,28 @@
11
// This issue reproduces an ICE on compile (E.g. fails on 2018-12-19 nightly).
2+
// "cannot relate bound region: ReLateBound(DebruijnIndex(1), BrAnon(1)) <= '_#1r"
23
// run-pass
34
// edition:2018
4-
#![feature(async_await,futures_api,generators)]
5+
#![feature(generators,generator_trait)]
6+
use std::ops::Generator;
57

6-
pub struct Foo;
7-
8-
impl Foo {
9-
async fn with<'a, F, R>(&'a self, f: F) -> R
10-
where F: Fn() -> R + 'a,
11-
{
8+
fn with<F>(f: F) -> impl Generator<Yield=(), Return=()>
9+
where F: Fn() -> ()
10+
{
11+
move || {
1212
loop {
1313
match f() {
1414
_ => yield,
1515
}
1616
}
1717
}
18+
}
1819

19-
pub async fn run<'a>(&'a self, data: &'a [u8])
20-
{
21-
let _to_pin = self.with(move || println!("{:p}", data));
20+
fn main() {
21+
let data = &vec![1];
22+
|| {
23+
let _to_pin = with(move || println!("{:p}", data));
2224
loop {
2325
yield
2426
}
25-
}
27+
};
2628
}
27-
fn main() {}

0 commit comments

Comments
 (0)