2021-05-12 15:46:14 +00:00
|
|
|
// 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>,
|
|
|
|
}
|
|
|
|
|
2021-05-08 21:06:37 +00:00
|
|
|
struct Third<'a, f> {
|
|
|
|
g: Vec<(f, &'a f)>,
|
2021-05-12 15:46:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
enum Ty {
|
|
|
|
j(Fourth, Fifth, Sixth),
|
|
|
|
}
|
|
|
|
|
|
|
|
struct Fourth {
|
|
|
|
o: Vec<Ty>,
|
|
|
|
}
|
|
|
|
|
|
|
|
struct Fifth {
|
|
|
|
bounds: First,
|
|
|
|
}
|
|
|
|
|
|
|
|
struct Sixth {
|
|
|
|
p: Box<Ty>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[rustc_evaluate_where_clauses]
|
2021-05-08 21:06:37 +00:00
|
|
|
fn forward<'a>()
|
2021-05-12 15:46:14 +00:00
|
|
|
where
|
|
|
|
Vec<First>: Unpin,
|
2021-05-08 21:06:37 +00:00
|
|
|
Third<'a, Ty>: Unpin,
|
2021-05-12 15:46:14 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
#[rustc_evaluate_where_clauses]
|
2021-05-08 21:06:37 +00:00
|
|
|
fn reverse<'a>()
|
2021-05-12 15:46:14 +00:00
|
|
|
where
|
2021-05-08 21:06:37 +00:00
|
|
|
Third<'a, Ty>: Unpin,
|
2021-05-12 15:46:14 +00:00
|
|
|
Vec<First>: Unpin,
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2021-05-08 21:06:37 +00:00
|
|
|
// Key is that Vec<First> is "ok" and Third<'_, Ty> is "ok modulo regions":
|
2021-05-12 15:46:14 +00:00
|
|
|
|
|
|
|
forward();
|
2021-10-14 19:15:44 +00:00
|
|
|
//~^ ERROR evaluate(Binder(TraitPredicate(<std::vec::Vec<First> as std::marker::Unpin>, polarity:Positive), [])) = Ok(EvaluatedToOk)
|
|
|
|
//~| ERROR evaluate(Binder(TraitPredicate(<Third<'_, Ty> as std::marker::Unpin>, polarity:Positive), [])) = Ok(EvaluatedToOkModuloRegions)
|
2021-05-12 15:46:14 +00:00
|
|
|
|
|
|
|
reverse();
|
2021-10-14 19:15:44 +00:00
|
|
|
//~^ ERROR evaluate(Binder(TraitPredicate(<std::vec::Vec<First> as std::marker::Unpin>, polarity:Positive), [])) = Ok(EvaluatedToOk)
|
|
|
|
//~| ERROR evaluate(Binder(TraitPredicate(<Third<'_, Ty> as std::marker::Unpin>, polarity:Positive), [])) = Ok(EvaluatedToOkModuloRegions)
|
2021-05-12 15:46:14 +00:00
|
|
|
}
|