Test unsized_non_final_field_is_rejected
Source location: tests/sized_trait.rs:238
#[test]
fn unsized_non_final_field_is_rejected() {
// Only the last field of a struct can be unsized.
FormalityTest::new(crates![crate Foo {
struct Bad<T> { prefix: T, tail: u32 }
}])
.rustc_ok()
.err(expect_test::expect![[r#"
crates/formality-rust/src/prove/prove_sized.rs:12:1: no applicable rules for prove_sized { ty: !ty_0, assumptions: {}, env: Env { variables: [!ty_0], bias: Soundness, pending: [], allow_pending_outlives: false } }
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 (8)
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_adt | check adt | scope(enter_universally(Env::default(), &adt.bin… (line 20, blamed at line 27) | not counted by the judgment view |
| check_fields_sized | struct | for_all(field in &fields[..fields.len().saturati… (line 47, blamed at line 48) | 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 74, blamed at line 75) | not counted by the judgment view |
| check_crate_item | adt | check_adt(program, s) => () (line 202) | 5 tests |
| prove_predicate | built-in Sized | prove_sized(decls, env, assumptions, ty) => c (line 94) | 9 tests |
| prove_predicate | trait implied bound | ti in decls.trait_invariants() (line 115) | 28 tests |
| prove_predicate_list | some | prove_predicate(decls, env, assumptions, wc0) =>… (line 26) | 92 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:75check_crate_item failedmod.rs:180rule "adt"mod.rs:202check_adt failedadts.rs:11args
rule "check adt"adts.rs:27check_fields_sized failedadts.rs:34args
rule "struct"adts.rs:48prove failedfunction.rs:250args
rulefunction.rs:250prove_predicate_list failedprove_predicate_list.rs:8args
rule "some"prove_predicate_list.rs:26prove_predicate failedprove_predicate.rs:23args
rule "built-in Sized"prove_predicate.rs:94prove_sized failedprove_sized.rs:12args
rule "trait implied bound"prove_predicate.rs:115 (failed: empty_collection)