]> git.proxmox.com Git - rustc.git/blob - src/test/ui/traits/cache-reached-depth-ice.rs
New upstream version 1.66.0+dfsg1
[rustc.git] / src / test / ui / traits / cache-reached-depth-ice.rs
1 #![feature(rustc_attrs)]
2
3 // Test for a particular corner case where the evaluation
4 // cache can get out of date. The problem here is that
5 // when we cache C, we have observed that it reaches
6 // to depth 2 (the node for B), but we later realize
7 // that B itself depends on A (reached depth 0). We
8 // failed to update the depth for C transitively, which
9 // resulted in an assertion failure when it was referenced
10 // from D.
11 //
12 // A (reached depth 0)
13 // E
14 // B // depth 2 -- reached depth = 0
15 // C // depth 3 -- reached depth = 2 (should be 0)
16 // B
17 // A // depth 0
18 // D (depth 1)
19 // C (cache -- reached depth = 2)
20
21 struct A {
22 e: E,
23 d: C,
24 }
25
26 struct E {
27 b: B,
28 }
29
30 struct B {
31 a: Option<Box<A>>,
32 c: C,
33 }
34
35 struct C {
36 b: Option<Box<B>>,
37 }
38
39 #[rustc_evaluate_where_clauses]
40 fn test<X: ?Sized + Send>() {}
41
42 fn main() {
43 test::<A>();
44 //~^ ERROR evaluate(Binder(TraitPredicate(<A as std::marker::Send>, polarity:Positive), [])) = Ok(EvaluatedToOk)
45 }