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

Negative coverage: check_trait_impl / check_trait_impl / premise check_safety_matches(&trait_decl, &trait_impl) => ()

Premise at line 32. Observed failure causes: failed_judgment.

check_trait_impl
LineCoverageSource
21N/A(let TraitImpl { binder, safety: _ } = &trait_impl)
22N/A(let (env, bound_data) = Env::default().instantiate_universally(binder))
23N/A(let TraitImplBoundData { trait_id, self_ty, trait_parameters, where_clauses, impl_items } = bound_data)
24N/A(let trait_ref = trait_id.with(self_ty, trait_parameters))
26(super::where_clauses::prove_where_clauses_well_formed(program, env, where_clauses, where_clauses) => ())
272(super::prove_goal(program, env, where_clauses, Predicate::is_implemented(trait_ref)) => ())
282(super::prove_not_goal(program, env, where_clauses, Predicate::not_implemented(trait_ref)) => ())
30(let trait_decl = program.program().trait_named(&trait_ref.trait_id)?)
31(let TraitBoundData { where_clauses: _, trait_items } = trait_decl.binder.instantiate_with(&trait_ref.parameters)?)
322(check_safety_matches(&trait_decl, &trait_impl) => ())
34(for_all(impl_item in impl_items)
(check_trait_impl_item(program, env, where_clauses, trait_items, impl_item, crate_id) => ()))
372(check_all_required_items_present(trait_items, impl_items) => ())
──────── ("check_trait_impl")
40110(check_trait_impl(program, trait_impl, crate_id) => ())

2 tests failed proving this premise:


Source location: tests/decl_safety.rs:63

#[test]
fn unsafe_trait_mismatch() {
    FormalityTest::new(crates![crate baguette {
        unsafe trait Foo {}
        impl Foo for u32 {}
    }])
    .err(expect_test::expect![[r#"
            the rule "safety matches" at (impls.rs) failed because
              condition evaluated to false: `trait_decl.safety == trait_impl.safety`"#]])
}
Failed proof tree

Source location: tests/decl_safety.rs:74

#[test]
fn safe_trait_mismatch() {
    FormalityTest::new(crates![crate baguette {
        trait Foo {}
        unsafe impl Foo for u32 {}
    }])
    .err(expect_test::expect![[r#"
            the rule "safety matches" at (impls.rs) failed because
              condition evaluated to false: `trait_decl.safety == trait_impl.safety`"#]])
}
Failed proof tree