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 loan_cannot_outlive_universal_regions

judgment_fn! {
    /// Prove that the loan does not outlive any universal regions.
    fn loan_cannot_outlive_universal_regions(
        env: TypeckEnv,
        assumptions: Predicates,
        outlives: Set<PendingOutlives>,
        loan: Loan,
    ) => () {
        /* rules omitted */
    }
}

Source: crates/formality-rust/src/check/borrow_check/nll.rs:1240

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.

loan_not_required_by_universal_regions
LineCoverageSource
1266N/A(let outlived_by_loan = transitively_outlived_by(&env, &outlives, &loan.lt))
12676(if outlived_by_loan.iter().all(|p| match p {
// If `'0: T` then `'0` must hold for entire fn body...
Parameter::Ty(_) => false,

Parameter::Lt(lt) => match lt.as_ref() {
// If `'0: 'static` then `'0` must hold for entire fn body...
Lt::Static => false,

// If `'0: 'a` for some lifetime parameter `'a`, then `'0` must hold for entire fn body...
Lt::Variable(Variable::UniversalVar(_)) => false,

// If `'0: '1`, that's fine.
Lt::Variable(Variable::ExistentialVar(_)) => true,

Lt::Variable(Variable::BoundVar(_)) => panic!("cannot outlive a bound var"),

// Erased lifetimes are used in codegen; treat like existential.
Lt::Erased => true,
},

// Not really clear what this would mean
Parameter::Const(_) => panic!("cannot outlive a constant"),
}))
──────── ("loan_not_required_by_universal_regions")
129118(loan_cannot_outlive_universal_regions(env, _assumptions, outlives, loan) => ())

How to read this page