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.
| Judgment | Rule | Premise | All tests of this premise |
|---|---|---|---|
| check_trait_impl | check_trait_impl | scope(enter_universally(Env::default(), binder) … (line 23, blamed at line 27) | not counted by the judgment view |
| check_all_crates | check all prefixes | for_all(i in 0..crates.len()) (let program = cra… (line 52, blamed at line 54) | not counted by the judgment view |
| check_crate | check crate | for_all(item in &c.items) (check_crate_item(prog… (line 73, blamed at line 74) | not counted by the judgment view |
| check_crate_item | trait impl | check_trait_impl(program, v, crate_id) => () (line 194) | 16 tests |
| prove_after | prove_after | prove(decls, c1.env(), assumptions, goal) => c2 (line 19) | 21 tests |
| prove_eq | symmetric | prove_eq(decls, env, assumptions, r, l) => env_c (line 38) | 17 tests |
| prove_eq | normalize-l | prove_normalize(decls, env, assumptions, x) => C… (line 68) | 17 tests |
| prove_normalize | normalize-via-assumption | prove_normalize_via(decls, env, assumptions, a, … (line 36) | 14 tests |
| prove_predicate | assumption | prove_via(decls, env, assumptions, a, goal) => c (line 48) | 34 tests |
| prove_predicate | positive impl | scope(enter_existentially_with_constraints(env, … (line 60, blamed at line 78) | not counted by the judgment view |
| prove_predicate | trait implied bound | ti in decls.trait_invariants() (line 106) | 19 tests |
| prove_predicate | eq | prove_eq(decls, env, assumptions, a, b) => c (line 115) | 17 tests |
| prove_predicate | const has ty | prove_const_has_type(decls, env, assumptions, co… (line 155) | 1 test |
| prove_predicate_list | some | prove_predicate(decls, env, assumptions, wc0) =>… (line 26) | 67 tests |
| prove_via | predicate-congruence-axiom | prove(decls, env, assumptions, Predicates::all_e… (line 32) | 2 tests |
Proof trees
Failed proof tree
check_all_crates failedmod.rs:42args
rule "check all prefixes"mod.rs:54check_crate failedmod.rs:61args
rule "check crate"mod.rs:74check_crate_item failedmod.rs:179rule "trait impl"mod.rs:194check_trait_impl failedimpls.rs:14rule "check_trait_impl"impls.rs:27prove failedfunction.rs:250args
rulefunction.rs:250prove_predicate_list failedprove_predicate_list.rs:8args
rule "some"prove_predicate_list.rs:26prove_predicate failedprove_predicate.rs:22args
rule "assumption"prove_predicate.rs:48prove_via failedprove_via.rs:9args
rule "positive impl"prove_predicate.rs:78prove_after failedprove_after.rs:8args
rule "prove_after"prove_after.rs:19prove failedprove_after.rs:19args
ruleprove_after.rs:19prove_predicate_list failedprove_predicate_list.rs:8args
rule "some"prove_predicate_list.rs:26prove_predicate failedprove_predicate.rs:22args
rule "assumption"prove_predicate.rs:48prove_via failedprove_via.rs:9args
rule "predicate-congruence-axiom"prove_via.rs:32prove failedprove_via.rs:32args
ruleprove_via.rs:32prove_predicate_list failedprove_predicate_list.rs:8args
rule "some"prove_predicate_list.rs:26prove_predicate failedprove_predicate.rs:22args
rule "assumption"prove_predicate.rs:48prove_via failedprove_via.rs:9args
rule "eq"prove_predicate.rs:115prove_eq failedprove_eq.rs:23args
rule "normalize-l"prove_eq.rs:68prove_normalize failedprove_normalize.rs:22args
rule "normalize-via-assumption"prove_normalize.rs:36prove_normalize_via failedprove_normalize.rs:55args
rule "symmetric"prove_eq.rs:38prove_eq failedprove_eq.rs:23args
rule "normalize-l"prove_eq.rs:68prove_normalize failedprove_normalize.rs:22args
rule "normalize-via-assumption"prove_normalize.rs:36prove_normalize_via failedprove_normalize.rs:55args
rule "const has ty"prove_predicate.rs:155prove_const_has_type failedprove_const_has_type.rs:11args
rule "trait implied bound"prove_predicate.rs:106 (failed: empty_collection)