1 // revisions: with_clause without_clause
2 // Tests that `EvaluatedToOkModuloRegions` from a projection sub-obligation
3 // is correctly propagated
5 #![feature(rustc_attrs)]
13 impl MyTrait for MyStruct {
14 // Evaluating this projection will result in `EvaluatedToOkModuloRegions`
15 // (when `with_clause` is enabled)
16 type Assoc = <Bar as MyTrait>::Assoc;
21 // The `where` clause on this impl will cause us to produce `EvaluatedToOkModuloRegions`
22 // when evaluating a projection involving this impl
24 impl MyTrait for Bar where for<'b> &'b (): 'b {
28 // This impl tests that the `EvaluatedToOkModuoRegions` result that we get
29 // is really due to the `where` clause on the `with_clause` impl
30 #[cfg(without_clause)]
31 impl MyTrait for Bar {
35 // The implementation of `#[rustc_evaluate_where_clauses]` doesn't perform
36 // normalization, so we need to place the projection predicate behind a normal
40 impl HelperTrait for Helper where <MyStruct as MyTrait>::Assoc: Sized {}
42 // Evaluating this 'where' clause will (recursively) end up evaluating
43 // `for<'b> &'b (): 'b`, which will produce `EvaluatedToOkModuloRegions`
44 #[rustc_evaluate_where_clauses]
45 fn test(val: MyStruct) where Helper: HelperTrait {
49 fn foo(val: MyStruct) {
51 //[with_clause]~^ ERROR evaluate(Binder(TraitPredicate(<Helper as HelperTrait>, polarity:Positive), [])) = Ok(EvaluatedToOkModuloRegions)
52 //[without_clause]~^^ ERROR evaluate(Binder(TraitPredicate(<Helper as HelperTrait>, polarity:Positive), [])) = Ok(EvaluatedToOk)