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_expr / ref / premise access_permitted( env, assumptions, state, Access::new(access_kind, place), places_live_on_exit, ) => state

Premise at line 478. Observed failure causes: failed_judgment.

ref
LineCoverageSource
466(borrow_check_place_expr(
env,
assumptions,
state,
place,
) => (place, state))
474N/A(let access_kind = match kind {
RefKind::Shared => AccessKind::Read,
RefKind::Mut => AccessKind::Write,
})
4787(access_permitted(
env,
assumptions,
state,
Access::new(access_kind, place),
places_live_on_exit,
) => state)
487N/A(let state = state.with_loan(Loan::new(lt, place, kind)))
488N/A(let state = state.with_outlives(&reborrow_constraints(place, lt)))
4951(verify_universal_outlives(env, assumptions, &state.current.outlives) => ())
496N/A(let ty = place.ty.ref_ty_of_kind(kind, lt))
──────── ("ref")
49829(borrow_check_expr(env, assumptions, state, Expr::Ref { kind, lt, place }, places_live_on_exit) => (ty, state))

7 tests failed proving this premise:


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

fn min_problem_case_3<'a>(m: &'a mut Map) -> &'a mut Map {
    exists<'r0, 'r1> {
        let n: &'r0 mut Map = &'r0 mut *m;
        if true {
            return n;
        } else {
            let o: &'r1 mut Map = &'r1 mut *m;
            return o;
        }
    }
}
Failed proof tree

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

fn foo<'a>(m: &'a mut Map) -> &'a mut Map {
    exists<'r0, 'r1> {
        let n: &'r0 mut Map = &'r0 mut *m;
        if false {
            return n;
        } else {
            let o: &'r1 mut Map = &'r1 mut *m;
            return o;
        }
    }
}
Failed proof tree

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

fn bar() -> u32 {
    exists<'r0, 'r1, 'r2> {
        let v: u32 = 0_u32;
        let p: &'r0 u32 = &'r1 v;
        let _: u32 = foo::<'r2>(&'r2 mut v);
        return *p;
    }
}
Failed proof tree

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

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;
    }
}
Failed proof tree

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

fn conditional() -> u32 {
    exists<'r0, 'r1, 'r2, 'r3> {
        let b: X = X { value: 0_u32 };
        let p: &'r0 mut X = &'r1 mut b;
        'l: loop {
            let now: &'r2 mut X = &'r2 mut *p;
            if true {
                if true {
                    let next: &'r3 mut X = next_of::<'r3>(&'r3 mut *now);
                    p = next;
                } else {
                }
            } else {
                break 'l;
            }
        }
        return 0_u32;
    }
}
Failed proof tree

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

fn next<'a>(d: &'a mut Decoder) -> &'a u32 {
    exists<'r0, 'r1> {
        'l: loop {
            let buf: &'r0 u32 = fill_buf::<'r0>(&'r0 mut (*d).buf_read);
            let s: &'r1 u32 = decode::<'r1>(buf);
            if true {
                return s;
            } else {
            }
        }
    }
}
Failed proof tree

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

fn next<'s>(f: &'s mut Filter) -> &'s mut u32 {
    exists<'r0, 'r1, 'r2> {
        'l: loop {
            let item: &'r0 mut u32 = iter_next::<'r0>(&'r0 mut (*f).iter);
            if true {
                let keep: bool = call_predicate::<'r1, 'r2>(&'r1 mut (*f).predicate, &'r2 *item);
                if keep {
                    return item;
                } else {
                }
            } else {
                break 'l;
            }
        }
        return no_item::<'s>();
    }
}
Failed proof tree