]> git.lizzy.rs Git - rust.git/blob - src/test/ui/traits/issue-23003.rs
:arrow_up: rust-analyzer
[rust.git] / src / test / ui / traits / issue-23003.rs
1 // run-pass
2 // Test stack overflow triggered by evaluating the implications. To be
3 // WF, the type `Receipt<Complete>` would require that `<Complete as
4 // Async>::Cancel` be WF. This normalizes to `Receipt<Complete>`
5 // again, leading to an infinite cycle. Issue #23003.
6
7 // pretty-expanded FIXME #23616
8
9 #![allow(dead_code)]
10 #![allow(unused_variables)]
11
12 use std::marker::PhantomData;
13
14 trait Async {
15     type Cancel;
16 }
17
18 struct Receipt<A:Async> {
19     marker: PhantomData<A>,
20 }
21
22 struct Complete {
23     core: Option<()>,
24 }
25
26 impl Async for Complete {
27     type Cancel = Receipt<Complete>;
28 }
29
30 fn foo(r: Receipt<Complete>) { }
31
32 fn main() { }