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

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.

JudgmentRulePremiseAll tests of this premise
borrow_checkborrow_checkborrow_check_block(env, assumptions, state, bloc… (line 135)113 tests
borrow_check_blockbasic blockfor_all(i in 0..stmts.len()) with(env, state) (b… (line 158, blamed at line 159)not counted by the judgment view
borrow_check_statementexprborrow_check_expr( env, assumptions, state, expr… (line 234)41 tests
borrow_check_exprcallborrow_check_expr( env, assumptions, state, call… (line 494)12 tests
borrow_check_exprturbofishborrow_check_fn_ref(env, assumptions, state, id,… (line 604)11 tests
borrow_check_fn_reffn-refprove_where_clauses(env, assumptions, state, whe… (line 670)11 tests
check_free_fncheck free fncheck_fn(program, Env::default(), Predicates::t(… (line 24)116 tests
check_fncheck fnscope(enter_universally(env, &f.binder) => (env,… (line 48, blamed at line 54)not counted by the judgment view
check_fn_bodyexpr fn bodyborrow_check(typeck_env, assumptions, initial_st… (line 89)114 tests
check_all_cratescheck all prefixesfor_all(i in 0..crates.len()) (let program = cra… (line 52, blamed at line 54)not counted by the judgment view
check_cratecheck cratefor_all(item in &c.items) (check_crate_item(prog… (line 74, blamed at line 75)not counted by the judgment view
check_crate_itemfree fncheck_free_fn(program, f, crate_id) => () (line 208)116 tests
prove_predicatebuilt-in Sizedprove_sized(decls, env, assumptions, ty) => c (line 94)9 tests
prove_predicatetrait implied boundti in decls.trait_invariants() (line 115)28 tests
prove_predicate_listsomeprove_predicate(decls, env, assumptions, wc0) =>… (line 26)92 tests
prove_sizedstructprove(decls, env, assumptions, Predicates::all_s… (line 50)4 tests

Proof trees

Failed proof tree

How to read this page