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

Test reborrow

Source location: tests/borrowck.rs:3912

fn reborrow<'a>(a: &'a mut u8) -> &'a mut u8 {
    exists<'r0, 'r1, 'r2, 'r3> {
        // This creates an outlives constraint
        let b: &'r1 mut u8 = &'r0 mut *a;
        if true {
            return b;
        } else {
            // this means the loan remains live
        }

        // If the outlives constraint propagated here,
        // we would get an error.
        let c: &'r3 mut u8 = &'r2 mut *a;
        return c;
    }
}

Rules proved (88)

JudgmentRuleAll tests of this rule
access_kind_for_place_usemove139 tests
access_permittedaccess_permitted142 tests
access_permitted_by_loanborrow of disjoint places63 tests
access_permitted_by_loanloan is dead43 tests
access_permitted_by_loanwrite-indirect23 tests
access_permitted_by_loansaccess_permitted_by_loans154 tests
borrow_checkborrow_check289 tests
borrow_check_blockbasic block289 tests
borrow_check_exprplace139 tests
borrow_check_exprref63 tests
borrow_check_exprtrue28 tests
borrow_check_expr_has_tyblock209 tests
borrow_check_place_exprderef-ref59 tests
borrow_check_place_exprlocal142 tests
borrow_check_statementexists71 tests
borrow_check_statementif29 tests
borrow_check_statementlet125 tests
borrow_check_statementreturn110 tests
can_outliveexistential target21 tests
check_all_cratescheck all prefixes331 tests
check_associated_tycheck associated ty312 tests
check_associated_ty_valuecheck_associated_ty_value311 tests
check_coherencecheck_coherence331 tests
check_cratecheck crate331 tests
check_crate_itemfeature gate84 tests
check_crate_itemfree fn291 tests
check_crate_itemtrait331 tests
check_crate_itemtrait impl327 tests
check_drop_impl_always_applicablenot a Drop impl327 tests
check_fncheck fn317 tests
check_fn_bodyexpr fn body289 tests
check_fn_bodyno fn body309 tests
check_fn_in_traitcheck fn in trait310 tests
check_free_fncheck free fn291 tests
check_safety_matchessafety matches327 tests
check_traitcheck trait331 tests
check_trait_implcheck_trait_impl327 tests
check_trait_impl_itemassociated ty value311 tests
check_trait_itemassociated ty in trait312 tests
check_trait_itemfn in trait310 tests
check_trait_manually_implementablenot Sized327 tests
drop_placesdrop_places289 tests
is_local_trait_reflocal trait322 tests
loan_cannot_outliveloan_cannot_outlive9 tests
loan_cannot_outlive_universal_regionsloan_not_required_by_universal_regions43 tests
loan_not_required_by_live_placeloan is not required by type20 tests
loan_not_required_by_live_place_prefixno prefix20 tests
loan_not_required_by_live_placesloan_not_required_by_live_places43 tests
loan_not_required_by_parameterlifetime9 tests
loan_not_required_by_parameterrigid-ty20 tests
loan_not_required_by_parametersloan_not_required_by_parameters20 tests
only_assumed_outlivesexistential65 tests
only_assumed_outlivesuniversal lifetime27 tests
orphan_checkorphan_check327 tests
overlap_check_impldifferent trait311 tests
overlap_check_implnot goal312 tests
overlap_check_implsame impl327 tests
prove_afterprove_after363 tests
prove_assignablesubtype223 tests
prove_eqexistential341 tests
prove_eqrigid318 tests
prove_eqsymmetric338 tests
prove_existential_var_eqexistential-nonvar73 tests
prove_existential_var_eqexistential-universal332 tests
prove_normalizenormalize-via-impl73 tests
prove_outlivesanything can be pending35 tests
prove_outlivesoutlive through assumption312 tests
prove_outlivesrigid types80 tests
prove_place_is_movablelocal126 tests
prove_predicateeq349 tests
prove_predicateoutlives321 tests
prove_predicateparameter well formed321 tests
prove_predicatepositive impl337 tests
prove_predicatesubtype228 tests
prove_predicatetrait ref is local328 tests
prove_predicate_listnone364 tests
prove_predicate_listsome363 tests
prove_sublifetime => outlives32 tests
prove_subnormalize-l35 tests
prove_subrigid36 tests
prove_ty_is_refref23 tests
prove_ty_is_rigidrigid184 tests
prove_wfintegers and booleans187 tests
prove_wfreferences309 tests
prove_wftuples317 tests
prove_wfuniversal variables323 tests
record_place_usemove139 tests
verify_universal_outlivesverify_universal_outlives66 tests

Premises failed (26)

The last column links to the premise’s page when the judgment view counts this failure against that premise. It does not when the premise is read as infallible, or when the failure was blamed inside a multi-line premise that carries no record on its own first line.

JudgmentRulePremiseAll tests of this premise
borrow_checkborrow_checkborrow_check_block(env, assumptions, state, bloc… (line 135)113 tests
borrow_check_blockbasic blockfor_all(i in 0..stmts.len()) with(env, state) (b… (line 158, blamed at line 159)not counted by the judgment view
borrow_check_statementletborrow_check_expr_has_ty(env, assumptions, state… (line 191)53 tests
borrow_check_statementexistsscope(env.enter_existentially(&with_variables(bi… (line 328, blamed at line 334)not counted by the judgment view
borrow_check_expr_has_tyblockborrow_check_expr(env, assumptions, state, expr,… (line 367)54 tests
borrow_check_exprrefaccess_permitted( env, assumptions, state, Acces… (line 559)13 tests
access_permittedaccess_permittedaccess_permitted_by_loans(env, assumptions, stat… (line 916)37 tests
access_permitted_by_loansaccess_permitted_by_loansfor_all(loan in &state.current.loans_live) with(… (line 935, blamed at line 936)not counted by the judgment view
access_permitted_by_loanborrow of disjoint placesif place_disjoint_from_place(&loan.place, &acces… (line 958)45 tests
access_permitted_by_loanwrite-indirectif let TypedPlaceExpressionData::Deref(place_loa… (line 985)37 tests
access_permitted_by_loanwrite-indirectif place_accessed.is_prefix_of(place_loaned_ref) (line 987)8 tests
access_permitted_by_loanloan is deadloan_not_required_by_live_places(env, assumption… (line 1005)41 tests
loan_cannot_outlive_universal_regionsloan_not_required_by_universal_regionsif outlived_by_loan.iter().all(|p| match p { // … (line 1327)10 tests
loan_not_required_by_live_placesloan_not_required_by_live_placesfor_all(live_place in places_live_after_access) … (line 1379, blamed at line 1381)not counted by the judgment view
loan_not_required_by_live_placeloan is not required by typeloan_not_required_by_parameter(env, assumptions,… (line 1408)41 tests
loan_not_required_by_parameterrigid-tyloan_not_required_by_parameters(env, assumptions… (line 1476)41 tests
loan_not_required_by_parameteruniversal-variableloan_cannot_outlive_universal_regions(env, assum… (line 1550)6 tests
loan_not_required_by_parameterlifetimeloan_cannot_outlive(env, assumptions, outlives, … (line 1566)41 tests
loan_cannot_outliveloan_cannot_outliveif !outlived_by_loan.contains(&lifetime.upcast()… (line 1586)41 tests
loan_not_required_by_parametersloan_not_required_by_parametersfor_all(param in live_parameters) (loan_not_requ… (line 1613, blamed at line 1614)not counted by the judgment view
check_free_fncheck free fncheck_fn(program, Env::default(), Predicates::t(… (line 24)116 tests
check_fncheck fnscope(enter_universally(env, &f.binder) => (env,… (line 48, blamed at line 54)not counted by the judgment view
check_fn_bodyexpr fn bodyborrow_check(typeck_env, assumptions, initial_st… (line 89)114 tests
check_all_cratescheck all prefixesfor_all(i in 0..crates.len()) (let program = cra… (line 52, blamed at line 54)not counted by the judgment view
check_cratecheck cratefor_all(item in &c.items) (check_crate_item(prog… (line 74, blamed at line 75)not counted by the judgment view
check_crate_itemfree fncheck_free_fn(program, f, crate_id) => () (line 208)116 tests

Proof trees

Proof tree
… (200 of 1699 nodes shown)
Failed proof tree

How to read this page