// Regression test for issue #83538. The problem here is that we have // two cycles: // // * `Ty` embeds `Box` 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, } pub struct Second { d: Vec, } struct Third<'a, f> { g: Vec<(f, &'a f)>, } enum Ty { j(Fourth, Fifth, Sixth), } struct Fourth { o: Vec, } struct Fifth { bounds: First, } struct Sixth { p: Box, } #[rustc_evaluate_where_clauses] fn forward<'a>() where Vec: Unpin, Third<'a, Ty>: Unpin, { } #[rustc_evaluate_where_clauses] fn reverse<'a>() where Third<'a, Ty>: Unpin, Vec: Unpin, { } fn main() { // Key is that Vec is "ok" and Third<'_, Ty> is "ok modulo regions": forward(); //~^ ERROR evaluate(Binder(TraitPredicate( as std::marker::Unpin>, polarity:Positive), [])) = Ok(EvaluatedToOk) //~| ERROR evaluate(Binder(TraitPredicate( as std::marker::Unpin>, polarity:Positive), [])) = Ok(EvaluatedToOkModuloRegions) reverse(); //~^ ERROR evaluate(Binder(TraitPredicate( as std::marker::Unpin>, polarity:Positive), [])) = Ok(EvaluatedToOk) //~| ERROR evaluate(Binder(TraitPredicate( as std::marker::Unpin>, polarity:Positive), [])) = Ok(EvaluatedToOkModuloRegions) }