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 borrow_check_statement

judgment_fn! {
    /// Prove that any loans issued in this statement are respected.
    fn borrow_check_statement(
        env: TypeckEnv,
        assumptions: Predicates,
        state: FlowState,
        statement: Stmt,
        places_live_on_exit: LivePlaces,
    ) => (TypeckEnv, FlowState) {
        /* rules omitted */
    }
}

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

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.

let
LineCoverageSource
186✗(prove_ty_is_wf(env, assumptions, state, ty) => state)
18936(borrow_check_expr_has_ty(env,
assumptions,
state,
expr,
ty,
LiveBefore::live_before(&Assignment(id), env, &state, &places_live_on_exit),
) => state)
196✗(let state = state.with_local_in_scope(&env.env, label, id, ty)?)
197N/A(let state = state.with_initialized(&PlaceExpr::Var(id.clone())))
──────── ("let")
19994(borrow_check_statement(env, assumptions, state, Stmt::Let { label, id, ty, init: Some(Init { expr }) }, places_live_on_exit) => (env, state))
let-no-init
LineCoverageSource
2031(prove_ty_is_wf(env, assumptions, state, ty) => state)
204✗(let state = state.with_local_in_scope(&env.env, label, id, ty)?)
205N/A(let state = state.with_uninit(&PlaceExpr::Var(id.clone())))
──────── ("let-no-init")
2076(borrow_check_statement(env, assumptions, state, Stmt::Let { label, id, ty, init: None }, places_live_on_exit) => (env, state))
if
LineCoverageSource
212✗(borrow_check_expr_has_ty(
env,
assumptions,
state,
condition,
Ty::bool(),
Either(then_block, &else_block.block).live_before(env, &state, places_live_on_exit),
) => state)
2222(borrow_check_block(env, assumptions, state, then_block, places_live_on_exit) => then_state)
2234(borrow_check_block(env, assumptions, state, &else_block.block, places_live_on_exit) => else_state)
226N/A(let state: FlowState = Union((then_state, else_state)).upcast())
──────── ("if")
22829(borrow_check_statement(env, assumptions, state, Stmt::If { condition, then_block, else_block }, places_live_on_exit) => (env, state))
expr
LineCoverageSource
23226(borrow_check_expr(
env,
assumptions,
state,
expr,
places_live_on_exit
) => (_init_ty, state))
──────── ("expr")
24047(borrow_check_statement(env, assumptions, state, Stmt::Expr { expr }, places_live_on_exit) => (env, state))
loop
LineCoverageSource
247N/A(let continue_live = Stmt::loop_(label, body).live_before(&env, &state, places_live_on_exit))
248✗(let state = state.push_continue_scope(&env.env, label, places_live_on_exit, continue_live)?)
2499(borrow_check_loop(env, assumptions, state, body, places_live_on_exit) => state)
250N/A(let state = state.pop_scope(label))
──────── ("loop")
25223(borrow_check_statement(env, assumptions, state, Stmt::Loop { label, body }, places_live_on_exit) => (env, state))
break
LineCoverageSource
258✗(if state.scope_has_label(label))
259N/A(let locals_to_drop = state.locals_dropped_to_label(label))
2602(drop_places(env, assumptions, state, locals_to_drop, places_live_on_exit) => state)
261N/A(let state = state.with_break(label))
262N/A(let state = state.diverges())
──────── ("break")
26417(borrow_check_statement(env, assumptions, state, Stmt::Break { label }, places_live_on_exit) => (env, state))
continue
LineCoverageSource
270✗(if state.scope_has_label(label))
2711(if let Some(places_live_on_continue) = state.live_after_continue(label))
272N/A(let locals_to_drop = state.locals_dropped_to_label(label))
2731(drop_places(env, assumptions, state, locals_to_drop, places_live_on_continue) => state)
274N/A(let state = state.with_continue(label))
275N/A(let state = state.diverges())
──────── ("continue")
2773(borrow_check_statement(env, assumptions, state, Stmt::Continue { label }, places_live_on_exit) => (env, state))
return
LineCoverageSource
2825(borrow_check_expr(env, assumptions, state, expr, LivePlaces::default()) => (expr_ty, state))
283✗(if let Some(output_ty) = &env.output_ty)
2844(prove_assignable(env, assumptions, state, expr_ty, output_ty) => state)
285N/A(let state = state.diverges())
──────── ("return")
28779(borrow_check_statement(env, assumptions, state, Stmt::Return { expr }, _places_live_on_exit) => (env, state))
block
LineCoverageSource
2924(borrow_check_block(env, assumptions, state, block, places_live_on_exit) => state)
──────── ("block")
2946(borrow_check_statement(env, assumptions, state, Stmt::Block(block), places_live_on_exit) => (env, state))
exists
LineCoverageSource
298✗(if feature_gate_enabled_in_program(&env.program, &FeatureGateName::PoloniusUnlocked))
300✗(scope(env.enter_existentially(&with_variables(binder)) => (env, (vars, block))) with(state)
(let assumptions_body = (assumptions, wf_assumptions_for_existential_vars(vars)))
(borrow_check_block(env, assumptions_body, state, block, places_live_on_exit) => state))
──────── ("exists")
30448(borrow_check_statement(env, assumptions, state, Stmt::Exists { binder }, places_live_on_exit) => (env, state))
exists
LineCoverageSource
308✗(if feature_gate_enabled_in_program(&env.program, &FeatureGateName::PoloniusAlpha))
310✗(scope(env.enter_existentially(&with_variables(binder)) => (env, (vars, block))) with(state)
(let assumptions_body = (assumptions, wf_assumptions_for_existential_vars(vars)))
(borrow_check_block(env, assumptions_body, state, block, places_live_on_exit) => state)
// Although we do not rerun borrowck with all outlives, Polonius Alpha
// does not change universal region constraints being checked on the
// full outlives set.
(verify_universal_outlives(env, assumptions_body, &state.all_outlives) => ()))
──────── ("exists")
31848(borrow_check_statement(env, assumptions, state, Stmt::Exists { binder }, places_live_on_exit) => (env, state))
exists
LineCoverageSource
322✗(if !feature_gate_enabled_in_program(&env.program, &FeatureGateName::PoloniusUnlocked) && !feature_gate_enabled_in_program(&env.program, &FeatureGateName::PoloniusAlpha))
324✗(scope(env.enter_existentially(&with_variables(binder)) => (env, (vars, block))) with(state)
(let assumptions_body = (assumptions, wf_assumptions_for_existential_vars(vars)))
(let entry_state = state.clone())
(borrow_check_block(env, assumptions_body, state, block, places_live_on_exit) => state)
// Rerun borrowck again, with the *entry* state combined with the entire outlives set.
(let state = entry_state.with_global_outlives_from(&state))
(borrow_check_block(env, assumptions_body, state, block, places_live_on_exit) => state))
──────── ("exists")
33248(borrow_check_statement(env, assumptions, state, Stmt::Exists { binder }, places_live_on_exit) => (env, state))
print
LineCoverageSource
337✗(borrow_check_expr(
env,
assumptions,
state,
expr,
places_live_on_exit
) => (_expr_ty, state))
──────── ("print")
34575(borrow_check_statement(env, assumptions, state, Stmt::Print { expr }, places_live_on_exit) => (env, state))

How to read this page