Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit b779f45

Browse files
committedJul 29, 2019
Add test for rust-lang#53678.
1 parent b2a5d99 commit b779f45

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
 
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// check-pass
2+
3+
#![feature(const_fn, generators, generator_trait, existential_type)]
4+
5+
use std::ops::Generator;
6+
7+
existential type GenOnce<Y, R>: Generator<Yield = Y, Return = R>;
8+
9+
const fn const_generator<Y, R>(yielding: Y, returning: R) -> GenOnce<Y, R> {
10+
move || {
11+
yield yielding;
12+
13+
return returning;
14+
}
15+
}
16+
17+
const FOO: GenOnce<usize, usize> = const_generator(10, 100);
18+
19+
fn main() {}

0 commit comments

Comments
 (0)