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

Test generic_mismatch

Source location: tests/consts.rs:76

#[test]
fn generic_mismatch() {
    FormalityTest::new(crates![crate Foo {
                trait Foo<const C> where type_of_const C is bool {}

                // Here, the impl is assuming C is u32, which mismatches the trait bound.
                impl<const C> Foo<C> for u32 where type_of_const C is u32 {}
            }]).err(expect_test::expect![[r#"
                crates/formality-rust/src/prove/prove_via.rs:9:1: no applicable rules for prove_via { goal: Foo(u32, !const_0), via: @ ConstHasType(!const_0 , u32), assumptions: {@ ConstHasType(!const_0 , u32)}, env: Env { variables: [!const_0], bias: Soundness, pending: [], allow_pending_outlives: false } }

                crates/formality-rust/src/prove/prove_via.rs:9:1: no applicable rules for prove_via { goal: u32 = bool, via: @ ConstHasType(!const_0 , u32), assumptions: {@ ConstHasType(!const_0 , u32)}, env: Env { variables: [!const_0], bias: Soundness, pending: [], allow_pending_outlives: false } }

                crates/formality-rust/src/prove/prove_normalize.rs:55:1: no applicable rules for prove_normalize_via { goal: u32, via: @ ConstHasType(!const_0 , u32), assumptions: {@ ConstHasType(!const_0 , u32)}, env: Env { variables: [!const_0], bias: Soundness, pending: [], allow_pending_outlives: false } }

                crates/formality-rust/src/prove/prove_normalize.rs:55:1: no applicable rules for prove_normalize_via { goal: bool, via: @ ConstHasType(!const_0 , u32), assumptions: {@ ConstHasType(!const_0 , u32)}, env: Env { variables: [!const_0], bias: Soundness, pending: [], allow_pending_outlives: false } }

                crates/formality-rust/src/prove/prove_const_has_type.rs:11:1: no applicable rules for prove_const_has_type { constant: !const_0, assumptions: {@ ConstHasType(!const_0 , u32)}, env: Env { variables: [!const_0], bias: Soundness, pending: [], allow_pending_outlives: false }, decls: program([crate core { trait Copy <ty> { } impl Copy for () { } impl Copy for u8 { } impl Copy for u16 { } impl Copy for u32 { } impl Copy for u64 { } impl Copy for u128 { } impl Copy for i8 { } impl Copy for i16 { } impl Copy for i32 { } impl Copy for i64 { } impl Copy for i128 { } impl Copy for bool { } impl Copy for usize { } impl Copy for isize { } impl <lt, ty> Copy for &^lt0_0 ^ty0_1 { } trait Drop <ty> { fn drop <lt> (self : &^lt0_0 mut ^ty1_0) where ^ty1_0 : ^lt0_0 ; } trait Derefable <ty> { type Target : [] ; } impl <lt, ty> Derefable for &^lt0_0 ^ty0_1 where ^ty0_1 : ^lt0_0 { type Target = ^ty1_1 ; } impl <lt, ty> Derefable for &^lt0_0 mut ^ty0_1 where ^ty0_1 : ^lt0_0 { type Target = ^ty1_1 ; } trait Sized <ty> { } impl Sized for () { } impl Sized for u8 { } impl Sized for u16 { } impl Sized for u32 { } impl Sized for u64 { } impl Sized for u128 { } impl Sized for i8 { } impl Sized for i16 { } impl Sized for i32 { } impl Sized for i64 { } impl Sized for i128 { } impl Sized for bool { } impl Sized for usize { } impl Sized for isize { } impl <lt, ty> Sized for &^lt0_0 ^ty0_1 { } impl <lt, ty> Sized for &^lt0_0 mut ^ty0_1 { } }, crate Foo { trait Foo <ty, const> where type_of_const ^const0_1 is bool { } impl <const> Foo <^const0_0> for u32 where type_of_const ^const0_0 is u32 { } }], 222) }

                the rule "trait implied bound" at (prove_predicate.rs) failed because
                  expression evaluated to an empty collection: `decls.trait_invariants()`"#]])
}

Rules proved (0)

This test records no positive coverage.

Premises failed (15)

The last column links to the premise’s page when the judgment view counts this failure against that premise. It does not when the premise is read as infallible, or when the failure was blamed inside a multi-line premise that carries no record on its own first line.

JudgmentRulePremiseAll tests of this premise
check_trait_implcheck_trait_implscope(enter_universally(Env::default(), binder) … (line 23, blamed at line 27)not counted by the judgment view
check_all_cratescheck all prefixesfor_all(i in 0..crates.len()) (let program = cra… (line 52, blamed at line 54)not counted by the judgment view
check_cratecheck cratefor_all(item in &c.items) (check_crate_item(prog… (line 73, blamed at line 74)not counted by the judgment view
check_crate_itemtrait implcheck_trait_impl(program, v, crate_id) => () (line 194)16 tests
prove_afterprove_afterprove(decls, c1.env(), assumptions, goal) => c2 (line 19)21 tests
prove_eqsymmetricprove_eq(decls, env, assumptions, r, l) => env_c (line 38)17 tests
prove_eqnormalize-lprove_normalize(decls, env, assumptions, x) => C… (line 68)17 tests
prove_normalizenormalize-via-assumptionprove_normalize_via(decls, env, assumptions, a, … (line 36)14 tests
prove_predicateassumptionprove_via(decls, env, assumptions, a, goal) => c (line 48)34 tests
prove_predicatepositive implscope(enter_existentially_with_constraints(env, … (line 60, blamed at line 78)not counted by the judgment view
prove_predicatetrait implied boundti in decls.trait_invariants() (line 106)19 tests
prove_predicateeqprove_eq(decls, env, assumptions, a, b) => c (line 115)17 tests
prove_predicateconst has typrove_const_has_type(decls, env, assumptions, co… (line 155)1 test
prove_predicate_listsomeprove_predicate(decls, env, assumptions, wc0) =>… (line 26)67 tests
prove_viapredicate-congruence-axiomprove(decls, env, assumptions, Predicates::all_e… (line 32)2 tests

Proof trees

Failed proof tree

How to read this page