2021-05-12 10:46:14 -05: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 16:06:37 -05:00
|
|
|
struct Third<'a, f> {
|
|
|
|
g: Vec<(f, &'a f)>,
|
2021-05-12 10:46:14 -05: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 16:06:37 -05:00
|
|
|
fn forward<'a>()
|
2021-05-12 10:46:14 -05:00
|
|
|
where
|
|
|
|
Vec<First>: Unpin,
|
2021-05-08 16:06:37 -05:00
|
|
|
Third<'a, Ty>: Unpin,
|
2021-05-12 10:46:14 -05:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
#[rustc_evaluate_where_clauses]
|
2021-05-08 16:06:37 -05:00
|
|
|
fn reverse<'a>()
|
2021-05-12 10:46:14 -05:00
|
|
|
where
|
2021-05-08 16:06:37 -05:00
|
|
|
Third<'a, Ty>: Unpin,
|
2021-05-12 10:46:14 -05:00
|
|
|
Vec<First>: Unpin,
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2021-05-08 16:06:37 -05:00
|
|
|
// Key is that Vec<First> is "ok" and Third<'_, Ty> is "ok modulo regions":
|
2021-05-12 10:46:14 -05:00
|
|
|
|
|
|
|
forward();
|
2023-06-19 08:39:55 -05:00
|
|
|
//~^ 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)
|
2021-05-12 10:46:14 -05:00
|
|
|
|
|
|
|
reverse();
|
2023-06-19 08:39:55 -05:00
|
|
|
//~^ 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)
|
2021-05-12 10:46:14 -05:00
|
|
|
}
|