2023-11-09 04:08:02 -06:00
|
|
|
//@ revisions: current next
|
2024-03-10 20:18:41 -05:00
|
|
|
//@ ignore-compare-mode-next-solver (explicit revisions)
|
2024-02-01 05:34:38 -06:00
|
|
|
//@[current] check-pass
|
2023-12-14 06:11:28 -06:00
|
|
|
//@[next] compile-flags: -Znext-solver
|
2023-10-19 16:46:28 -05:00
|
|
|
#![feature(coroutines, coroutine_trait)]
|
2023-01-07 18:29:30 -06:00
|
|
|
|
2023-10-19 11:06:43 -05:00
|
|
|
use std::ops::{Coroutine, CoroutineState};
|
2023-01-07 18:29:30 -06:00
|
|
|
|
2023-10-19 11:06:43 -05:00
|
|
|
fn foo() -> impl Coroutine<Yield = (), Return = ()> {
|
2024-04-02 06:20:03 -05:00
|
|
|
// FIXME(-Znext-solver): this fails with a mismatched types as the
|
|
|
|
// hidden type of the opaque ends up as {type error}. We should not
|
|
|
|
// emit errors for such goals.
|
|
|
|
|| { //[next]~ ERROR mismatched types
|
2023-01-07 18:29:30 -06:00
|
|
|
let mut gen = Box::pin(foo());
|
2024-02-01 05:34:38 -06:00
|
|
|
//[next]~^ ERROR type annotations needed
|
2023-01-07 18:29:30 -06:00
|
|
|
let mut r = gen.as_mut().resume(());
|
2023-10-19 11:06:43 -05:00
|
|
|
while let CoroutineState::Yielded(v) = r {
|
2023-01-07 18:29:30 -06:00
|
|
|
yield v;
|
|
|
|
r = gen.as_mut().resume(());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
foo();
|
|
|
|
}
|