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!()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-06-10 11:17:38 -05:00
|
|
|
mod helper {
|
|
|
|
use super::*;
|
|
|
|
pub type F = impl Future;
|
|
|
|
fn foo()
|
|
|
|
where
|
|
|
|
F:,
|
|
|
|
{
|
|
|
|
async fn cb() {
|
|
|
|
let a = Foo; //~ ERROR cannot find value `Foo` in this scope
|
|
|
|
}
|
2021-01-13 18:00:00 -06:00
|
|
|
|
2024-06-10 11:17:38 -05:00
|
|
|
Task::spawn(&POOL, || cb());
|
|
|
|
}
|
2021-01-13 18:00:00 -06:00
|
|
|
}
|
2024-06-10 11:17:38 -05:00
|
|
|
|
|
|
|
// Check that statics are inhabited computes they layout.
|
|
|
|
static POOL: Task<helper::F> = Task::new();
|
|
|
|
|
|
|
|
fn main() {}
|