File tree Expand file tree Collapse file tree 1 file changed +13
-12
lines changed
src/test/run-pass/generator Expand file tree Collapse file tree 1 file changed +13
-12
lines changed Original file line number Diff line number Diff line change 1
1
// 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"
2
3
// run-pass
3
4
// edition:2018
4
- #![feature(async_await,futures_api,generators)]
5
+ #![feature(generators,generator_trait)]
6
+ use std::ops::Generator;
5
7
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 || {
12
12
loop {
13
13
match f() {
14
14
_ => yield,
15
15
}
16
16
}
17
17
}
18
+ }
18
19
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));
22
24
loop {
23
25
yield
24
26
}
25
- }
27
+ };
26
28
}
27
- fn main() {}
You can’t perform that action at this time.
0 commit comments