]> git.lizzy.rs Git - rust.git/blob - src/test/ui/generator/layout-error.rs
Auto merge of #98051 - davidtwco:split-dwarf-stabilization, r=wesleywiser
[rust.git] / src / test / ui / generator / layout-error.rs
1 // Verifies that computing a layout of a generator tainted by type errors
2 // doesn't ICE. Regression test for #80998.
3 //
4 // edition:2018
5
6 #![feature(type_alias_impl_trait)]
7 use std::future::Future;
8
9 pub struct Task<F: Future>(F);
10 impl<F: Future> Task<F> {
11     const fn new() -> Self {
12         todo!()
13     }
14     fn spawn(&self, _: impl FnOnce() -> F) {
15         todo!()
16     }
17 }
18
19 fn main() {
20     async fn cb() {
21         let a = Foo; //~ ERROR cannot find value `Foo` in this scope
22     }
23
24     type F = impl Future;
25     // Check that statics are inhabited computes they layout.
26     static POOL: Task<F> = Task::new();
27     Task::spawn(&POOL, || cb());
28 }