]> git.proxmox.com Git - rustc.git/blame - src/test/ui/generator/layout-error.rs
New upstream version 1.52.0~beta.3+dfsg1
[rustc.git] / src / test / ui / generator / layout-error.rs
CommitLineData
5869c6ff
XL
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
6a06907d
XL
6// revisions: min_tait full_tait
7#![feature(min_type_alias_impl_trait)]
8#![cfg_attr(full_tait, feature(impl_trait_in_bindings, type_alias_impl_trait))]
9//[full_tait]~^ WARN incomplete
10//[full_tait]~| WARN incomplete
5869c6ff
XL
11use std::future::Future;
12
13pub struct Task<F: Future>(F);
14impl<F: Future> Task<F> {
6a06907d 15 const fn new() -> Self {
5869c6ff
XL
16 todo!()
17 }
18 fn spawn(&self, _: impl FnOnce() -> F) {
19 todo!()
20 }
21}
22
23fn main() {
24 async fn cb() {
25 let a = Foo; //~ ERROR cannot find value `Foo` in this scope
26 }
27
28 type F = impl Future;
29 // Check that statics are inhabited computes they layout.
6a06907d
XL
30 static POOL: Task<F> = Task::new(); //[min_tait]~ ERROR not permitted here
31 Task::spawn(&POOL, || cb()); //[min_tait]~ ERROR type alias impl trait is not permitted here
32 //[min_tait]~^ ERROR concrete type differs from previous
5869c6ff 33}