diff options
Diffstat (limited to 'tests/ui/type-alias-impl-trait/issue-53678-coroutine-and-const-fn.rs')
-rw-r--r-- | tests/ui/type-alias-impl-trait/issue-53678-coroutine-and-const-fn.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/ui/type-alias-impl-trait/issue-53678-coroutine-and-const-fn.rs b/tests/ui/type-alias-impl-trait/issue-53678-coroutine-and-const-fn.rs new file mode 100644 index 000000000..ad1ede9c3 --- /dev/null +++ b/tests/ui/type-alias-impl-trait/issue-53678-coroutine-and-const-fn.rs @@ -0,0 +1,22 @@ +#![feature(coroutines, coroutine_trait, rustc_attrs)] +#![feature(type_alias_impl_trait)] + +// check-pass + +mod gen { + use std::ops::Coroutine; + + pub type CoroOnce<Y, R> = impl Coroutine<Yield = Y, Return = R>; + + pub const fn const_coroutine<Y, R>(yielding: Y, returning: R) -> CoroOnce<Y, R> { + move || { + yield yielding; + + return returning; + } + } +} + +const FOO: gen::CoroOnce<usize, usize> = gen::const_coroutine(10, 100); + +fn main() {} |