]> git.lizzy.rs Git - rust.git/blob - src/test/ui/impl-trait/issues/issue-83919.rs
:arrow_up: rust-analyzer
[rust.git] / src / test / ui / impl-trait / issues / issue-83919.rs
1 #![feature(type_alias_impl_trait)]
2
3 // edition:2021
4
5 use std::future::Future;
6
7 trait Foo {
8     type T;
9     type Fut2: Future<Output=Self::T>; // ICE got triggered with traits other than Future here
10     type Fut: Future<Output=Self::Fut2>;
11     fn get_fut(&self) -> Self::Fut;
12 }
13
14 struct Implementor;
15
16 impl Foo for Implementor {
17     type T = u64;
18     type Fut2 = impl Future<Output=u64>;
19     type Fut = impl Future<Output=Self::Fut2>;
20
21     fn get_fut(&self) -> Self::Fut {
22     //~^ ERROR `{integer}` is not a future
23         async move {
24             42
25             // 42 does not impl Future and rustc does actually point out the error,
26             // but rustc used to panic.
27             // Putting a valid Future here always worked fine.
28         }
29     }
30 }
31
32 fn main() {}