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

Positive coverage: borrow_check_expr / call

call
LineCoverageSource
3883(borrow_check_expr(
env,
assumptions,
state,
callee,
args.live_before(env, &state, places_live),
) => (callee_ty, state))
397(prove_ty_is_rigid(env, assumptions, state, callee_ty) => (RigidTy { name: RigidName::FnDef(fn_id), parameters }, state))
400(let Fn { id: _, safety, binder } = env.crates().fn_named(fn_id)?)
402(ProvenSet::singleton((safety, ProofTree::leaf("safety"))) => Safety::Safe)
403(let FnBoundData { input_args, output_ty, where_clauses, body: _ } =
binder.instantiate_with(parameters)?)
407N/A(let input_tys: Vec<Ty> = input_args.iter().map(|a| a.ty.clone()).collect())
4081(if input_tys.len() == args.len())
410(for_all(i in 0..args.len()) with(state)
(borrow_check_expr_has_ty(env, assumptions, state, &args[i], &input_tys[i], places_live) => state))
413(prove_where_clauses(env, assumptions, state, where_clauses) => state)
──────── ("call")
41514(borrow_check_expr(env, assumptions, state, Expr::Call { callee, args }, places_live) => (output_ty, state))

14 tests exercised this rule:


Source location: tests/borrowck.rs:2806

fn foo<'a>(a: &'a u32) -> &'a u32 {
    exists<'r0> {
        let r: &'r0 u32 = identity::<&'r0 u32>(a);
        return r;
    }
}
Proof tree
… (200 of 1138 nodes shown)

Source location: tests/borrowck.rs:2828

fn bar() -> u32 {
    exists<'r1> {
        let v: u32 = 7 _ u32;
        let r: u32 = foo::<'r1>(&'r1 v);
        return r;
    }
}
Proof tree
… (200 of 1223 nodes shown)

Source location: tests/borrowck.rs:2856

fn foo<'a, 'b>(a: &'a u32) -> &'b u32
where 'a: 'b {
    let r: &'b u32 = identity::<&'b u32>(a);
    return r;
}
Proof tree
… (200 of 1131 nodes shown)

Source location: tests/borrowck.rs:2901

fn foo<'b>(a: &'b u32) -> &'b u32 {
    let r: &'b u32 = bar::<'b, &'b u32>(a);
    return r;
}
Proof tree
… (200 of 1134 nodes shown)

Source location: tests/borrowck.rs:2922

fn bar() -> u32 {
    exists<'r0, 'r1> {
        let v: u32 = 1 _ u32;
        let p: &'r0 u32 = &'r1 v;
        foo(0 _ u32);
        return *p;
    }
}
Proof tree
… (200 of 1231 nodes shown)

Source location: tests/codegen.rs:64

fn main() -> () {
    let y: i32 = add_one(1 _ i32);
    println!(y);
}
Proof tree
… (200 of 1060 nodes shown)

Source location: tests/codegen.rs:79

fn main() -> () {
    let y: i32 = identity::<i32>(42 _ i32);
    println!(y);
}
Proof tree
… (200 of 1060 nodes shown)

Source location: tests/codegen.rs:188

fn main() -> () {
    let a: i32 = f(1 _ i32);
    let b: i32 = f(2 _ i32);
    let c: i32 = f(3 _ i32);
    println!(a);
    println!(b);
    println!(c);
}
Proof tree
… (200 of 1136 nodes shown)

Source location: tests/codegen.rs:201

fn main() -> () {
    let y: i32 = f(f(42 _ i32));
    println!(y);
}
Proof tree
… (200 of 1072 nodes shown)

Source location: tests/codegen.rs:218

fn main() -> () {
    let r: i32 = outer(7 _ i32);
    println!(r);
}
Proof tree
… (200 of 1131 nodes shown)

Source location: tests/codegen.rs:238

fn main() -> () {
    a();
}

Proof trees omitted for the remaining 4 tests.


Source location: tests/codegen.rs:251

fn main() -> () {
    let r: i32 = first::<i32, bool>(10 _ i32, true);
    println!(r);
}

Source location: tests/mir_typeck.rs:171

fn bar(v1: u32) -> u32 {
    let v0: u32 = foo(v1);
    return v0;
}

Source location: tests/mir_typeck.rs:345

fn bar(v1: u32) -> u32 {
    let v0: u32 = identity::<u32>(v1);
    return v0;
}