Test forward
Source location: tests/sized_trait.rs:464
fn forward<T>(value: Tail<T>) -> () { consume::<Tail<T>>(value); }
}])
tc_ok()
(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: true } }
the rule "trait implied bound" at (prove_predicate.rs) failed because
expression evaluated to an empty collection: `decls.trait_invariants()`
the rule "trait implied bound" at (prove_predicate.rs) failed because
expression evaluated to an empty collection: `decls.trait_invariants()`"#]]);
}
#540: use the associated-type Sized bound; remove should_panic when fixed.
#[test]
_panic(expected = "prove_sized { ty: <!ty_0 as Tr>::A")]
iated_sized_bound_allows_nonfinal_struct_field() {
program = crates![crate Foo {
trait Tr { type A: [Sized]; }
struct S<T> where T: Tr { first: <T as Tr>::A, last: u32 }
fn main() -> () {}
}];
heck rustc before the expected formality failure.
(ok, stderr) = formality_rust::to_rust::test_util::run_rustc(&program);
rt!(ok, "{stderr}");
alityTest::new(program).rustc_ok().ok();
}
#540: use the associated-type Sized bound; remove should_panic when fixed.
#[test]
_panic(expected = "prove_sized { ty: <!ty_0 as Tr>::A")]
iated_sized_bound_allows_enum_field() {
program = crates![crate Foo {
trait Tr { type A: [Sized]; }
enum E<T> where T: Tr { Some { value: <T as Tr>::A }, None {} }
fn main() -> () {}
}];
heck rustc before the expected formality failure.
(ok, stderr) = formality_rust::to_rust::test_util::run_rustc(&program);
rt!(ok, "{stderr}");
alityTest::new(program).rustc_ok().ok();
}
#[test]
d_struct_sized_bound_executes() {
alityTest::new(crates![crate Foo {
struct Tail<T> { prefix: u32, tail: T }
struct Outer<T> { inner: Tail<T> }
fn consume<T>(value: T) -> u32 where T: Sized { return 7_u32; }
fn main() -> () {
println!(consume::<Outer<u32>>(Outer::<u32> {
inner: Tail::<u32> { prefix: 1_u32, tail: 2_u32 }
}));
}
Rules proved (0)
This test records no positive coverage.
Premises failed (16)
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 |
|---|---|---|---|
| borrow_check | borrow_check | borrow_check_block(env, assumptions, state, bloc… (line 135) | 113 tests |
| borrow_check_block | basic block | for_all(i in 0..stmts.len()) with(env, state) (b… (line 158, blamed at line 159) | not counted by the judgment view |
| borrow_check_statement | expr | borrow_check_expr( env, assumptions, state, expr… (line 234) | 41 tests |
| borrow_check_expr | call | borrow_check_expr( env, assumptions, state, call… (line 494) | 12 tests |
| borrow_check_expr | turbofish | borrow_check_fn_ref(env, assumptions, state, id,… (line 604) | 11 tests |
| borrow_check_fn_ref | fn-ref | prove_where_clauses(env, assumptions, state, whe… (line 670) | 11 tests |
| check_free_fn | check free fn | check_fn(program, Env::default(), Predicates::t(… (line 24) | 116 tests |
| check_fn | check fn | scope(enter_universally(env, &f.binder) => (env,… (line 48, blamed at line 54) | not counted by the judgment view |
| check_fn_body | expr fn body | borrow_check(typeck_env, assumptions, initial_st… (line 89) | 114 tests |
| 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 | free fn | check_free_fn(program, f, crate_id) => () (line 208) | 116 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 |
| prove_sized | struct | prove(decls, env, assumptions, Predicates::all_s… (line 50) | 4 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 "free fn"mod.rs:208check_free_fn failedfns.rs:14args
rule "check free fn"fns.rs:24check_fn failedfns.rs:31args
rule "check fn"fns.rs:54check_fn_body failedfns.rs:61args
rule "expr fn body"fns.rs:89borrow_check failednll.rs:124args
rule "borrow_check"nll.rs:135borrow_check_block failednll.rs:144rule "basic block"nll.rs:159borrow_check_statement failednll.rs:176args
rule "expr"nll.rs:234borrow_check_expr failednll.rs:375args
rule "call"nll.rs:494borrow_check_expr failednll.rs:375args
rule "turbofish"nll.rs:604borrow_check_fn_ref failednll.rs:654args
rule "fn-ref"nll.rs:670prove 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 "struct"prove_sized.rs:50prove failedprove_sized.rs:50args
ruleprove_sized.rs:50prove_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)
rule "trait implied bound"prove_predicate.rs:115 (failed: empty_collection)