2023-10-19 16:46:28 -05:00
|
|
|
// Verifies that computing a layout of a coroutine tainted by type errors
|
2021-01-13 18:00:00 -06:00
|
|
|
// doesn't ICE. Regression test for #80998.
|
|
|
|
//
|
|
|
|
// edition:2018
|
|
|
|
|
2021-07-26 15:01:16 -05:00
|
|
|
#![feature(type_alias_impl_trait)]
|
2021-01-13 18:00:00 -06:00
|
|
|
use std::future::Future;
|
|
|
|
|
|
|
|
pub struct Task<F: Future>(F);
|
|
|
|
impl<F: Future> Task<F> {
|
2021-03-12 06:02:29 -06:00
|
|
|
const fn new() -> Self {
|
2021-01-13 18:00:00 -06:00
|
|
|
todo!()
|
|
|
|
}
|
|
|
|
fn spawn(&self, _: impl FnOnce() -> F) {
|
|
|
|
todo!()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
async fn cb() {
|
|
|
|
let a = Foo; //~ ERROR cannot find value `Foo` in this scope
|
|
|
|
}
|
|
|
|
|
|
|
|
type F = impl Future;
|
|
|
|
// Check that statics are inhabited computes they layout.
|
2021-07-16 08:06:26 -05:00
|
|
|
static POOL: Task<F> = Task::new();
|
2021-07-26 15:01:16 -05:00
|
|
|
Task::spawn(&POOL, || cb());
|
2021-01-13 18:00:00 -06:00
|
|
|
}
|