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: borrow_check_statement / return / premise drop_places(env, assumptions, state, locals_to_drop, LivePlaces::default()) => state

Premise at line 288. Observed failure causes: failed_judgment.

return
LineCoverageSource
2845(borrow_check_expr(env, assumptions, state, expr, LivePlaces::default()) => (expr_ty, state))
285✗(if let Some(output_ty) = &env.output_ty)
2864(prove_assignable(env, assumptions, state, expr_ty, output_ty) => state)
287N/A(let locals_to_drop = state.locals_dropped_on_return())
2882(drop_places(env, assumptions, state, locals_to_drop, LivePlaces::default()) => state)
289N/A(let state = state.diverges())
──────── ("return")
291110(borrow_check_statement(env, assumptions, state, Stmt::Return { expr }, _places_live_on_exit) => (env, state))

2 tests failed proving this premise:


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

fn dangling<'a>() -> &'a u32 {
    let x: u32 = 22_u32;
    exists<'r0> {
        return &'r0 x;
    }
}
Failed proof tree

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

fn dangling<'a>(x: u32) -> &'a u32 {
    exists<'r0> {
        return &'r0 x;
    }
}
Failed proof tree

How to read this page