Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Positive coverage: prove_via / forall

forall
LineCoverageSource
49✗(scope(enter_existentially_with_constraints(decls, env, assumptions, binder) => (env, via1)) with(c)
// Try to prove `T: Trait<?a> == goal`.
(prove_via(decls, env, assumptions, via1, goal) => c))
──────── ("forall")
536(prove_via(decls, env, assumptions, Predicate::ForAll(binder), goal) => c)

6 tests exercised this rule:


Source location: tests/basic_tests.rs:149 (all coverage from this test)

#[test]
fn non_lifetime_binder_in_trait_impl_where_clause_pass() {
    FormalityTest::new(crates![crate core {
        #![feature(non_lifetime_binders)]
        trait A<T> where T: B { }

        trait B { }

        impl<T> B for T where for<U> u32: A<U> { }
    }])
    .skip_execute()
    .ok()
}
Proof tree

Source location: tests/basic_tests.rs:179 (all coverage from this test)

#[test]
fn non_lifetime_binder_in_neg_trait_impl_where_clause_pass() {
    FormalityTest::new(crates![crate core {
        #![feature(non_lifetime_binders)]
        trait A<T> where T: B { }

        trait B { }

        impl<T> !A<T> for u32 where for<U> u32: A<U> { }

        impl <T> B for T {}
    }])
    .skip_execute()
    .ok()
}
Proof tree

Source location: tests/higher_ranked_where_clauses.rs:28 (all coverage from this test)

fn foo<T>() -> () where for<'a> T: Trait<'a> {
    exists<'r> {
        needs_one::<'r, T>();
    }
}
Proof tree
… (200 of 1414 nodes shown)

Source location: tests/higher_ranked_where_clauses.rs:42 (all coverage from this test)

fn foo<'b, T>() -> () where for<'a> T: Trait<'a> {
    needs_one::<'b, T>();
}
Proof tree
… (200 of 1367 nodes shown)

Source location: tests/higher_ranked_where_clauses.rs:56 (all coverage from this test)

fn foo<T>() -> () where for<'a> T: Trait<'a> {
    needs_all::<T>();
}
Proof tree
… (200 of 1373 nodes shown)

Source location: tests/higher_ranked_where_clauses.rs:118 (all coverage from this test)

fn foo<T>() -> u32 where for<'a> T: Trait<'a> {
    let v: u32 = 1_u32;
    exists<'r> {
        let r: &'r u32 = first::<'r, T>(&'r v);
        let n: u32 = *r;
        v = 2_u32;
        return n;
    }
}
Proof tree
… (200 of 1946 nodes shown)

How to read this page