os-rust/tests/ui/coroutine/issue-88653.rs

25 lines
718 B
Rust
Raw Normal View History

// Regression test for #88653, where a confusing warning about a
2023-10-19 21:46:28 +00:00
// type mismatch in coroutine arguments was issued.
2023-10-19 21:46:28 +00:00
#![feature(coroutines, coroutine_trait)]
2023-10-19 16:06:43 +00:00
use std::ops::Coroutine;
2023-10-19 16:06:43 +00:00
fn foo(bar: bool) -> impl Coroutine<(bool,)> {
2023-10-19 21:46:28 +00:00
//~^ ERROR: type mismatch in coroutine arguments [E0631]
2022-07-28 19:33:10 +04:00
//~| NOTE: expected due to this
2023-10-19 21:46:28 +00:00
//~| NOTE: expected coroutine signature `fn((bool,)) -> _`
2022-07-28 19:33:10 +04:00
//~| NOTE: in this expansion of desugaring of `impl Trait`
//~| NOTE: in this expansion of desugaring of `impl Trait`
#[coroutine]
|bar| {
2022-07-28 19:33:10 +04:00
//~^ NOTE: found signature defined here
//~| NOTE: return type was inferred to be
if bar {
yield bar;
}
}
}
fn main() {}