Negative coverage: check_drop_impl_always_applicable / Drop impl is always applicable / premise check_drop_impl_in_defining_crate(program, adt_id, crate_id) => ()
Premise at line 322. Observed failure causes: inapplicable.
Drop impl is always applicable| Line | Coverage | Source |
|---|---|---|
| 318 | ✗ | (if **trait_impl.trait_id() == *"Drop") |
| 320 | 1 | (let adt_id = drop_impl_adt_id(&trait_impl)?) |
| 322 | 1 | (check_drop_impl_in_defining_crate(program, adt_id, crate_id) => ()) |
| 323 | ✗ | (let adt = program.program().adt_item_named(adt_id)?.to_adt()) |
| 325 | N/A | (let (env, adt_vars) = Env::default().universal_substitution(&adt.binder)) |
| 326 | ✗ | (let adt_bound = adt.binder.instantiate_with(adt_vars)?) |
| 327 | N/A | (let adt_self_ty = Ty::rigid(adt_id, adt_vars)) |
| 330 | N/A | (let drop_trait_ref = crate::grammar::TraitId::new("Drop").with(adt_self_ty, ())) |
| 331 | 3 | (super::prove_goal(&program, &env, &adt_bound.where_clauses, Predicate::IsImplemented(drop_trait_ref.clone())) => ()) |
| ──────── ("Drop impl is always applicable") | ||
| 334 | 6 | (check_drop_impl_always_applicable(program, trait_impl, crate_id) => ()) |
1 test failed proving this premise:
Source location: tests/drop.rs:214
#[test]
fn drop_impl_foreign_adt() {
FormalityTest::new(crates![
crate a {
struct MyStruct {
value: u32,
}
},
crate b {
impl Drop for MyStruct {}
}
])
.err(expect_test::expect![[r#"
the rule "Drop impl is always applicable" at (impls.rs) failed because
`Drop` may only be implemented for types defined in the current crate: `MyStruct` is defined in crate `a` but the impl is in crate `b`"#]])
}
Failed proof tree
check_all_crates failedmod.rs:41args
rule "check all prefixes"mod.rs:53check_crate failedmod.rs:60args
rule "check crate"mod.rs:73check_crate_item failedmod.rs:178rule "trait impl"mod.rs:194check_drop_impl_always_applicable failedimpls.rs:301rule "Drop impl is always applicable"impls.rs:322 (failed: inapplicable)