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

Judgment prove_outlives

judgment_fn! {
    /// A *outlives* B if --
    ///
    /// * "as long as B is valid, A is valid"
    /// * "if A is invalidated, B *may* be invalidated"
    ///
    /// Outlives is "reflexive" -- `'a: 'a`.
    ///
    /// Examples:
    ///
    /// * `'static: 'a` -- true
    /// *
    ///
    /// Borrow check flow example
    ///
    /// ```rust,ignore
    /// fn main() {
    ///     let mut i = 22;
    ///     let p: &'?0 i32 = &i;
    ///     let q: &'?1 i32 = p;   // subtyping requires `&'?0 i32 <: &'?1: i32` requires `'?0: '?1`
    ///     if condition() {
    ///         i += 1;         // <- ok, `p` is dead
    ///     } else {
    ///         i += 1;         // <- error, `p` is live (via `q`)
    ///         println("{q}");
    ///     }
    /// }
    /// ```
    pub fn prove_outlives(
        _decls: Program,
        env: Env,
        assumptions: Predicates,
        a: Parameter,
        b: Parameter,
    ) => Constraints {
        /* rules omitted */
    }
}

Source: crates/formality-rust/src/prove/prove_outlives.rs:8

No applicable rule observed: at least one test exercised this judgment with no matching rule.

The number on each rule’s conclusion is positive coverage; the number on each premise is negative coverage. Click a number to browse the tests.

static outlives everything
LineCoverageSource
──────── ("static outlives everything")
52✗(prove_outlives(_decls, _env, _assumptions, Lt::Static, _b) => Constraints::none(env))
anything outlives erased
LineCoverageSource
──────── ("anything outlives erased")
58✗(prove_outlives(_decls, _env, _assumptions, _a, Lt::Erased) => Constraints::none(env))
erased outlives static
LineCoverageSource
──────── ("erased outlives static")
64✗(prove_outlives(_decls, _env, _assumptions, Lt::Erased, Lt::Static) => Constraints::none(env))
rigid types
LineCoverageSource
69✗(prove(decls, env, assumptions, Predicates::all_outlives(parameters, b)) => c)
──────── ("rigid types")
7155(prove_outlives(decls, env, assumptions, RigidTy { name: _, parameters }, b) => c)
outlive through assumption
LineCoverageSource
77N/A(let all_outlives = transitively_outlived_by(assumptions, a))
78✗(if all_outlives.contains(&*b))
──────── ("outlive through assumption")
80195(prove_outlives(_decls, env, assumptions, a, b) => Constraints::none(env))
anything can be pending
LineCoverageSource
87✗(if env.allow_pending_outlives())
──────── ("anything can be pending")
8929(prove_outlives(_decls, env, _assumptions, a, b) => Constraints::none(
env.with_pending(AtomicPredicate::outlives(a, b))
))

How to read this page