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

Positive coverage: prove_outlives / outlive static through assumption

outlive static through assumption
LineCoverageSource
85N/A(let all_outlives = transitively_outlived_by(assumptions, a))
86✗(if all_outlives.contains(&Lt::Static.to::<Parameter>()))
──────── ("outlive static through assumption")
8811(prove_outlives(_decls, env, assumptions, a, _b) => Constraints::none(env))

11 tests exercised this rule:


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

#[test]
fn outlives_every_lifetime_given_static() {
    test_prove_pending_outlives(
        Program::empty(),
        term("forall<'x> {'x : 'static} => {for<'a> 'x : 'a}"),
    )
    .assert_ok(expect!["{Constraints { env: Env { variables: [!lt_1], bias: Soundness, pending: [], allow_pending_outlives: true }, known_true: true, substitution: {} }, Constraints { env: Env { variables: [!lt_1], bias: Soundness, pending: [!lt_1 : ' static], allow_pending_outlives: true }, known_true: true, substitution: {} }}"]);
}
Proof tree

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

#[test]
fn outlives_static_gives_any_lifetime() {
    test_prove(
        Program::empty(),
        term("forall<'x, 'y> {'x : 'static} => {'x : 'y}"),
    )
    .assert_ok(expect!["{Constraints { env: Env { variables: [!lt_1, !lt_2], bias: Soundness, pending: [], allow_pending_outlives: false }, known_true: true, substitution: {} }}"]);
}
Proof tree

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

#[test]
fn for_all_outlives_gives_static() {
    test_prove(
        Program::empty(),
        term("forall<T> {for<'a> T : 'a} => {T : 'static}"),
    )
    .assert_ok(expect!["{Constraints { env: Env { variables: [!ty_1], bias: Soundness, pending: [], allow_pending_outlives: false }, known_true: true, substitution: {} }}"]);
}
Proof tree

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

#[test]
fn for_all_outlives_gives_any_lifetime() {
    test_prove(
        Program::empty(),
        term("forall<T, 'x> {for<'a> T : 'a} => {T : 'x}"),
    )
    .assert_ok(expect!["{Constraints { env: Env { variables: [!ty_1, !lt_2], bias: Soundness, pending: [], allow_pending_outlives: false }, known_true: true, substitution: {} }}"]);
}
Proof tree

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

#[test]
fn multiple_bound_lifetimes_give_static() {
    // Exercise both binder positions, including an unused bound lifetime.
    for assertion in [
        "forall<T> {for<'a, 'b> T : 'a} => {T : 'static}",
        "forall<T> {for<'a, 'b> T : 'b} => {T : 'static}",
    ] {
        test_prove(Program::empty(), term(assertion))
            .assert_ok(expect!["{Constraints { env: Env { variables: [!ty_1], bias: Soundness, pending: [], allow_pending_outlives: false }, known_true: true, substitution: {} }}"]);
    }
}
Proof tree

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

#[test]
fn higher_ranked_outlives_is_transitive() {
    test_prove(
        Program::empty(),
        term("forall<T, 'x> {T : 'x, for<'a> 'x : 'a} => {T : 'static}"),
    )
    .assert_ok(expect!["{Constraints { env: Env { variables: [!ty_1, !lt_2], bias: Soundness, pending: [], allow_pending_outlives: false }, known_true: true, substitution: {} }}"]);
}
Proof tree

Source location: tests/higher_ranked_where_clauses.rs:176 (all coverage from this test)

fn foo<T>() -> () where for<'a> T: 'a {
    needs_static::<T>();
}
Proof tree
… (200 of 1340 nodes shown)

Source location: tests/higher_ranked_where_clauses.rs:189 (all coverage from this test)

fn foo<'x, T>() -> () where for<'a> T: 'a {
    needs_one::<'x, T>();
}
Proof tree
… (200 of 1340 nodes shown)

Source location: tests/higher_ranked_where_clauses.rs:202 (all coverage from this test)

fn foo<T>() -> () where for<'a> T: 'a {
    needs_all::<T>();
}
Proof tree
… (200 of 1348 nodes shown)

Source location: tests/higher_ranked_where_clauses.rs:215 (all coverage from this test)

fn foo<'x, 'y>(v: &'x u32) -> &'y u32 where 'x: 'static {
    return v;
}
Proof tree
… (200 of 1358 nodes shown)

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

fn caller<'x>(v: &'x u32) -> () where 'x: 'static {
    needs_all::<&'x u32>(v);
}

Proof trees omitted for the remaining 1 tests; each one is on its test’s page in Coverage by test.


How to read this page