1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
// Regression test for issue #83538. The problem here is that we have
// two cycles:
//
// * `Ty` embeds `Box<Ty>` indirectly, which depends on `Global: 'static`, which is OkModuloRegions.
// * But `Ty` also references `First`, which has a cycle on itself. That should just be `Ok`.
//
// But our caching mechanism was blending both cycles and giving the incorrect result.
#![feature(rustc_attrs)]
#![allow(bad_style)]
struct First {
b: Vec<First>,
}
pub struct Second {
d: Vec<First>,
}
struct Third<'a, f> {
g: Vec<(f, &'a f)>,
}
enum Ty {
j(Fourth, Fifth, Sixth),
}
struct Fourth {
o: Vec<Ty>,
}
struct Fifth {
bounds: First,
}
struct Sixth {
p: Box<Ty>,
}
#[rustc_evaluate_where_clauses]
fn forward<'a>()
where
Vec<First>: Unpin,
Third<'a, Ty>: Unpin,
{
}
#[rustc_evaluate_where_clauses]
fn reverse<'a>()
where
Third<'a, Ty>: Unpin,
Vec<First>: Unpin,
{
}
fn main() {
// Key is that Vec<First> is "ok" and Third<'_, Ty> is "ok modulo regions":
forward();
//~^ ERROR evaluate(Binder { value: TraitPredicate(<std::vec::Vec<First> as std::marker::Unpin>, polarity:Positive), bound_vars: [] }) = Ok(EvaluatedToOk)
//~| ERROR evaluate(Binder { value: TraitPredicate(<Third<'_, Ty> as std::marker::Unpin>, polarity:Positive), bound_vars: [] }) = Ok(EvaluatedToOkModuloRegions)
reverse();
//~^ ERROR evaluate(Binder { value: TraitPredicate(<std::vec::Vec<First> as std::marker::Unpin>, polarity:Positive), bound_vars: [] }) = Ok(EvaluatedToOk)
//~| ERROR evaluate(Binder { value: TraitPredicate(<Third<'_, Ty> as std::marker::Unpin>, polarity:Positive), bound_vars: [] }) = Ok(EvaluatedToOkModuloRegions)
}
|