Files
rust/tests/ui/traits/next-solver/coroutine.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

33 lines
608 B
Rust
Raw Normal View History

2023-12-14 13:11:28 +01:00
// compile-flags: -Znext-solver
2023-01-24 23:38:20 +00:00
// edition: 2021
// revisions: pass fail
//[pass] check-pass
2023-10-19 21:46:28 +00:00
#![feature(coroutine_trait, coroutines)]
2023-01-24 23:38:20 +00:00
2023-10-19 16:06:43 +00:00
use std::ops::Coroutine;
2023-01-24 23:38:20 +00:00
struct A;
struct B;
struct C;
2023-10-19 21:46:28 +00:00
fn needs_coroutine(_: impl Coroutine<A, Yield = B, Return = C>) {}
2023-01-24 23:38:20 +00:00
#[cfg(fail)]
fn main() {
2023-10-19 21:46:28 +00:00
needs_coroutine(|| {
2023-10-19 16:06:43 +00:00
//[fail]~^ ERROR Coroutine<A>` is not satisfied
//[fail]~| ERROR as Coroutine<A>>::Yield == B`
//[fail]~| ERROR as Coroutine<A>>::Return == C`
2023-01-24 23:38:20 +00:00
yield ();
});
}
#[cfg(pass)]
fn main() {
2023-10-19 21:46:28 +00:00
needs_coroutine(|_: A| {
2023-01-24 23:38:20 +00:00
let _: A = yield B;
C
})
}