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: prove_predicate / outlives / premise prove_outlives(decls, env, assumptions, a, b) => c

Premise at line 151. Observed failure causes: failed_judgment.

outlives
LineCoverageSource
15110(prove_outlives(decls, env, assumptions, a, b) => c)
──────── ("outlives")
153321(prove_predicate(decls, env, assumptions, AtomicPredicate::Outlives(a, b)) => c)

10 tests failed proving this premise:


Source location: crates/formality-rust/src/prove/test/outlives.rs:42 (all coverage from this test)

#[test]
fn outlives_one_lifetime_does_not_give_static() {
    test_prove(
        Program::empty(),
        term("forall<T, 'x> {T : 'x} => {T : 'static}"),
    )
    .assert_err(expect![[r#"
        crates/formality-rust/src/prove/prove_via.rs:9:1: no applicable rules for prove_via { goal: !ty_0 : ' static, via: !ty_0 : !lt_1, assumptions: {!ty_0 : !lt_1}, env: Env { variables: [!ty_0, !lt_1], bias: Soundness, pending: [], allow_pending_outlives: false } }

        crates/formality-rust/src/prove/prove_outlives.rs:8:1: no applicable rules for prove_outlives { a: !ty_0, b: ' static, assumptions: {!ty_0 : !lt_1}, env: Env { variables: [!ty_0, !lt_1], bias: Soundness, pending: [], allow_pending_outlives: false } }"#]]);
}
Failed proof tree

Source location: tests/borrowck.rs:2901 (all coverage from this test)

fn foo<'a, 'b>(v1: &'a u32) -> &'b u32 {
    exists<'r0> {
        let v2: &'r0 u32 = v1;
        return v2;
    }
}
Failed proof tree

Source location: tests/borrowck.rs:2931 (all coverage from this test)

fn foo<'a, 'b>(v1: &'a u32, v2: &'b u32) -> () {
    let output: &'b u32 = v2;
    loop {
        output = v1;
    }
}
Failed proof tree

Source location: tests/borrowck.rs:2996 (all coverage from this test)

fn foo<'a, 'b, 'c>(v1: &'a u32) -> &'c u32
where
    'a: 'b,
{
    return v1;
}
Failed proof tree

Source location: tests/borrowck.rs:3667 (all coverage from this test)

fn foo<'a, 'b>(a: &'a u32) -> &'b u32 {
    let r: &'b u32 = identity::<&'b u32>(a);
    return r;
}
Failed proof tree

Source location: tests/borrowck.rs:4232 (all coverage from this test)

fn foo<'a, 'b>(p: &'a mut u32) -> u32 {
    let q: &'b mut u32 = &'b mut *p;
    q;
    return 0_u32;
}
Failed proof tree

Source location: tests/borrowck.rs:5028 (all coverage from this test)

fn use_it<'a, 'b>() -> u32 {
    exists<'r0> {
        let v: Invariant<'r0> = create_invariant::<'r0>();
        if true {
            return sink::<'a, 'r0>(v);
        } else {
            return sink::<'b, 'r0>(v);
        }
    }
}
Failed proof tree

Source location: tests/borrowck.rs:5059 (all coverage from this test)

fn use_both<'a, 'b>() -> u32 {
    exists<'r0> {
        let v: Invariant<'r0> = create_invariant::<'r0>();
        let w: Invariant<'r0> = create_invariant::<'r0>();
        sink::<'a, 'r0>(v);
        sink::<'b, 'r0>(w);
        return 0_u32;
    }
}
Failed proof tree

Source location: tests/mir_typeck.rs:1944 (all coverage from this test)

fn main() -> () {}
}])
tc_err(expect_test::expect![[r#"
error: lifetime may not live long enough
 --> lib.rs
  |
7 | pub fn outer<'a00, 'a01>() -> () {
  |              ----  ---- lifetime `'a01` defined here
  |              |
  |              lifetime `'a00` defined here
8 |     require::<'a00, 'a01>;
  |     ^^^^^^^^^^^^^^^^^^^^^ requires that `'a00` must outlive `'a01`
  |
  = help: consider adding the following bound: `'a00: 'a01`

error: could not compile `Foo` (lib) due to 1 previous error
)
(expect_test::expect!["crates/formality-rust/src/prove/prove_outlives.rs:8:1: no applicable rules for prove_outlives { a: !lt_0, b: !lt_1, assumptions: {}, env: Env { variables: [!lt_0, !lt_1], bias: Soundness, pending: [], allow_pending_outlives: false } }"]);
}

ound assignment of an integer of a different type should fail.
#[test]
compound_add_mismatched_int_types() {
alityTest::new(crates![crate Foo {
fn foo() -> () {
    let x: u32 = 1_u32;
    x += 2_u8;
}
Failed proof tree

Source location: tests/outlives.rs:42 (all coverage from this test)

#[test]
fn assoc_type_impl_violates_static_bound() {
    FormalityTest::new(crates![crate Foo {
        trait A { type Item: ['static]; }
        impl<'a> A for &'a u32 { type Item = &'a u32; }
    }])
    .skip_execute()
    .rustc_err(expect_test::expect![[r#"
        error[E0477]: the type `&'a00 u32` does not fulfill the required lifetime
         --> lib.rs
          |
        6 |     type Item = &'a00 u32;
          |                 ^^^^^^^^^
          |
        note: type must satisfy the static lifetime as required by this binding
         --> lib.rs
          |
        2 |     type Item: 'static;
          |                ^^^^^^^

        For more information about this error, try `rustc --explain E0477`.
        error: could not compile `Foo` (lib) due to 1 previous error
    "#]])
    .err(expect_test::expect!["crates/formality-rust/src/prove/prove_outlives.rs:8:1: no applicable rules for prove_outlives { a: !lt_0, b: ' static, assumptions: {}, env: Env { variables: [!lt_0], bias: Soundness, pending: [], allow_pending_outlives: false } }"]);
}
Failed proof tree

How to read this page