Skip to content

Commit 7026845

Browse files
committed
Add regresion test for #87142
1 parent 4a52e0f commit 7026845

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

src/test/ui/generator/issue-87142.rs

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// compile-flags: -Cdebuginfo=2
2+
// build-pass
3+
4+
// Regression test for #87142
5+
// This test needs the above flags and the "lib" crate type.
6+
7+
#![feature(type_alias_impl_trait, generator_trait, generators)]
8+
#![crate_type = "lib"]
9+
10+
use std::ops::Generator;
11+
12+
pub trait GeneratorProviderAlt: Sized {
13+
type Gen: Generator<(), Return = (), Yield = ()>;
14+
15+
fn start(ctx: Context<Self>) -> Self::Gen;
16+
}
17+
18+
pub struct Context<G: 'static + GeneratorProviderAlt> {
19+
pub link: Box<G::Gen>,
20+
}
21+
22+
impl GeneratorProviderAlt for () {
23+
type Gen = impl Generator<(), Return = (), Yield = ()>;
24+
fn start(ctx: Context<Self>) -> Self::Gen {
25+
move || {
26+
match ctx {
27+
_ => (),
28+
}
29+
yield ();
30+
}
31+
}
32+
}

0 commit comments

Comments
 (0)