Negative coverage: borrow_check_expr / call / premise borrow_check_expr( env, assumptions, state, callee, args.live_before(env, &state, places_live), ) => (callee_ty, state)
Premise at line 455. Observed failure causes: failed_judgment.
call| Line | Coverage | Source |
|---|---|---|
| 455 | 6 | (borrow_check_expr( env, assumptions, state, callee, args.live_before(env, &state, places_live), ) => (callee_ty, state)) |
| 464 | ✗ | (prove_ty_is_rigid(env, assumptions, state, callee_ty) => (RigidTy { name: RigidName::FnDef(fn_id), parameters }, state)) |
| 467 | ✗ | (let Fn { id: _, safety, binder } = env.crates().fn_named(fn_id)?) |
| 469 | ✗ | (ProvenSet::singleton((safety, ProofTree::leaf("safety"))) => Safety::Safe) |
| 470 | ✗ | (let FnBoundData { input_args, output_ty, where_clauses, body: _ } = binder.instantiate_with(parameters)?) |
| 474 | N/A | (let input_tys: Vec<Ty> = input_args.iter().map(|a| a.ty.clone()).collect()) |
| 475 | 1 | (if input_tys.len() == args.len()) |
| 477 | ✗ | (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)) |
| 480 | ✗ | (prove_where_clauses(env, assumptions, state, where_clauses) => state) |
| ──────── ("call") | ||
| 482 | 41 | (borrow_check_expr(env, assumptions, state, Expr::Call { callee, args }, places_live) => (output_ty, state)) |
6 tests failed proving this premise:
Source location: tests/borrowck.rs:4831 (all coverage from this test)
fn use_it<'a, 'b>() -> u32 {
exists<'r0> {
let v: Invariant<'r0> = create_invariant::<'r0>();
if true {
return sink::<'a, 'r0>(v);
} else {
return sink::<'b, 'r0>(v);
}
}
}
Source location: tests/borrowck.rs:4862 (all coverage from this test)
fn use_both<'a, 'b>() -> u32 {
exists<'r0> {
let v: Invariant<'r0> = create_invariant::<'r0>();
let w: Invariant<'r0> = create_invariant::<'r0>();
sink::<'a, 'r0>(v);
sink::<'b, 'r0>(w);
return 0_u32;
}
}
Failed proof tree
check_all_crates failedmod.rs:42args
rule "check all prefixes"mod.rs:54check_crate failedmod.rs:61args
rule "check crate"mod.rs:74check_crate_item failedmod.rs:179rule "free fn"mod.rs:207check_free_fn failedfns.rs:14args
rule "check free fn"fns.rs:24check_fn failedfns.rs:31args
rule "check fn"fns.rs:54check_fn_body failedfns.rs:61args
rule "expr fn body"fns.rs:89borrow_check failednll.rs:124args
rule "borrow_check"nll.rs:135borrow_check_block failednll.rs:142rule "basic block"nll.rs:157borrow_check_statement failednll.rs:174args
rule "exists"nll.rs:302borrow_check_block failednll.rs:142args
rule "basic block"nll.rs:157borrow_check_statement failednll.rs:174args
rule "expr"nll.rs:232borrow_check_expr failednll.rs:371args
rule "call"nll.rs:455borrow_check_expr failednll.rs:371args
rule "turbofish"nll.rs:566borrow_check_fn_ref failednll.rs:616args
rule "fn-ref"nll.rs:632verify_universal_outlives failedoutlives.rs:8args
rule "verify_universal_outlives"outlives.rs:20only_assumed_outlives failedoutlives.rs:27args
rule "universal lifetime"outlives.rs:49can_outlive failedoutlives.rs:56args
rule "universal target"outlives.rs:81prove failedoutlives.rs:81args
ruleoutlives.rs:81prove_predicate_list failedprove_predicate_list.rs:8args
rule "some"prove_predicate_list.rs:26prove_predicate failedprove_predicate.rs:22args
rule "assumption"prove_predicate.rs:48prove_via failedprove_via.rs:9args
rule "outlives"prove_predicate.rs:142prove_outlives failedprove_outlives.rs:8args
Source location: tests/mir_typeck.rs:345 (all coverage from this test)
fn bar() -> u32 {
let v1: u32 = foo(0_u32);
return v1;
}
Failed proof tree
check_all_crates failedmod.rs:42args
rule "check all prefixes"mod.rs:54check_crate failedmod.rs:61args
rule "check crate"mod.rs:74check_crate_item failedmod.rs:179rule "free fn"mod.rs:207check_free_fn failedfns.rs:14args
rule "check free fn"fns.rs:24check_fn failedfns.rs:31args
rule "check fn"fns.rs:54check_fn_body failedfns.rs:61args
rule "expr fn body"fns.rs:89borrow_check failednll.rs:124args
rule "borrow_check"nll.rs:135borrow_check_block failednll.rs:142rule "basic block"nll.rs:157borrow_check_statement failednll.rs:174args
rule "let"nll.rs:189borrow_check_expr_has_ty failednll.rs:350args
rule "block"nll.rs:363borrow_check_expr failednll.rs:371args
rule "call"nll.rs:455borrow_check_expr failednll.rs:371args
rule "fn-name"nll.rs:559borrow_check_fn_ref failednll.rs:616args
rule "fn-ref"nll.rs:629 (failed: inapplicable)
rule "place"nll.rs:545borrow_check_place_expr failednll.rs:668args
rule "local"nll.rs:679 (failed: inapplicable)
Source location: tests/mir_typeck.rs:416 (all coverage from this test)
fn bar(v1: u32) -> u32 {
let v0: u32 = identity(v1);
return v0;
}
Failed proof tree
check_all_crates failedmod.rs:42args
rule "check all prefixes"mod.rs:54check_crate failedmod.rs:61args
rule "check crate"mod.rs:74check_crate_item failedmod.rs:179rule "free fn"mod.rs:207check_free_fn failedfns.rs:14args
rule "check free fn"fns.rs:24check_fn failedfns.rs:31args
rule "check fn"fns.rs:54check_fn_body failedfns.rs:61args
rule "expr fn body"fns.rs:89borrow_check failednll.rs:124args
rule "borrow_check"nll.rs:135borrow_check_block failednll.rs:142rule "basic block"nll.rs:157borrow_check_statement failednll.rs:174args
rule "let"nll.rs:189borrow_check_expr_has_ty failednll.rs:350args
rule "block"nll.rs:363borrow_check_expr failednll.rs:371args
rule "call"nll.rs:455borrow_check_expr failednll.rs:371args
rule "fn-name"nll.rs:559borrow_check_fn_ref failednll.rs:616args
rule "fn-ref"nll.rs:630 (failed: if_false)
rule "place"nll.rs:545borrow_check_place_expr failednll.rs:668args
rule "local"nll.rs:679 (failed: inapplicable)
Source location: tests/mir_typeck.rs:568 (all coverage from this test)
fn bar(v1: u32) -> u32 {
let v0: u32 = identity::<u32, u32>(v1);
return v0;
}
Failed proof tree
check_all_crates failedmod.rs:42args
rule "check all prefixes"mod.rs:54check_crate failedmod.rs:61args
rule "check crate"mod.rs:74check_crate_item failedmod.rs:179rule "free fn"mod.rs:207check_free_fn failedfns.rs:14args
rule "check free fn"fns.rs:24check_fn failedfns.rs:31args
rule "check fn"fns.rs:54check_fn_body failedfns.rs:61args
rule "expr fn body"fns.rs:89borrow_check failednll.rs:124args
rule "borrow_check"nll.rs:135borrow_check_block failednll.rs:142rule "basic block"nll.rs:157borrow_check_statement failednll.rs:174args
rule "let"nll.rs:189borrow_check_expr_has_ty failednll.rs:350args
rule "block"nll.rs:363borrow_check_expr failednll.rs:371args
rule "call"nll.rs:455borrow_check_expr failednll.rs:371args
rule "turbofish"nll.rs:566borrow_check_fn_ref failednll.rs:616args
rule "fn-ref"nll.rs:630 (failed: if_false)
Source location: tests/mir_typeck.rs:1438 (all coverage from this test)
fn main() -> () { require_marker::<S>(); }
}])
tc_err(expect_test::expect![[r#"
error[E0277]: the trait bound `S: Marker` is not satisfied
--> lib.rs
|
13 | require_marker::<S>();
| ^ unsatisfied trait bound
|
help: the trait `Marker` is not implemented for `S`
--> lib.rs
|
3 | pub struct S {}
| ^^^^^^^^^^^^
help: this trait has no implementations, consider adding one
--> lib.rs
|
1 | pub trait Marker {}
| ^^^^^^^^^^^^^^^^
note: required by a bound in `require_marker`
--> lib.rs
|
5 | pub fn require_marker<T00>() -> ()
| -------------- required by a bound in this function
6 | where
7 | T00: Marker,
| ^^^^^^ required by this bound in `require_marker`
For more information about this error, try `rustc --explain E0277`.
error: could not compile `test` (lib) due to 1 previous error
)
(expect_test::expect![[r#"
the rule "trait implied bound" at (prove_predicate.rs) failed because
expression evaluated to an empty collection: `decls.trait_invariants()`"#]]);
}
ng the function with a type that implements `Marker` is accepted.
#[test]
generic_fn_value_with_satisfied_where_clause() {
alityTest::new(crates![crate test {
trait Marker {}
impl Marker for u32 {}
fn require_marker<T>() -> () where T: Marker {}
fn main() -> () { require_marker::<u32>; }
}])
tc_ok()
);
}
#[test]
fn_value_with_forwarded_trait_bound() {
alityTest::new(crates![crate Foo {
trait Marker {}
impl Marker for u32 {}
fn require<T>() -> () where T: Marker {}
fn outer<T>() -> () where T: Marker { require::<T>; }
fn main() -> () { outer::<u32>(); }
}])
tc_ok()
);
}
#[test]
bare_fn_value_with_satisfied_where_clause() {
alityTest::new(crates![crate Foo {
trait Marker {}
impl Marker for u32 {}
fn require() -> () where u32: Marker {}
fn main() -> () { require; }
}])
tc_ok()
);
}
#[test]
fn_value_with_forwarded_lifetime_bound() {
alityTest::new(crates![crate Foo {
fn require<'a, 'b>() -> () where 'a: 'b {}
fn outer<'a, 'b>() -> () where 'a: 'b { require::<'a, 'b>; }
fn main() -> () { outer::<'static, 'static>(); }
}])
tc_ok()
);
}
#[test]
fn_value_with_unsatisfied_lifetime_bound() {
alityTest::new(crates![crate Foo {
fn require<'a, 'b>() -> () where 'a: 'b {}
fn outer<'a, 'b>() -> () { require::<'a, 'b>; }
fn main() -> () {}
}])
tc_err(expect_test::expect![[r#"
error: lifetime may not live long enough
--> lib.rs
|
7 | pub fn outer<'a00, 'a01>() -> () {
| ---- ---- lifetime `'a01` defined here
| |
| lifetime `'a00` defined here
8 | require::<'a00, 'a01>;
| ^^^^^^^^^^^^^^^^^^^^^ requires that `'a00` must outlive `'a01`
|
= help: consider adding the following bound: `'a00: 'a01`
error: could not compile `Foo` (lib) due to 1 previous error
)
(expect_test::expect!["crates/formality-rust/src/prove/prove_outlives.rs:8:1: no applicable rules for prove_outlives { a: !lt_0, b: !lt_1, assumptions: {}, env: Env { variables: [!lt_0, !lt_1], bias: Soundness, pending: [], allow_pending_outlives: false } }"]);
}
ound assignment of an integer of a different type should fail.
#[test]
compound_add_mismatched_int_types() {
alityTest::new(crates![crate Foo {
fn foo() -> () {
let x: u32 = 1_u32;
x += 2_u8;
}
Failed proof tree
check_all_crates failedmod.rs:42args
rule "check all prefixes"mod.rs:54check_crate failedmod.rs:61args
rule "check crate"mod.rs:74check_crate_item failedmod.rs:179rule "free fn"mod.rs:207check_free_fn failedfns.rs:14args
rule "check free fn"fns.rs:24check_fn failedfns.rs:31args
rule "check fn"fns.rs:54check_fn_body failedfns.rs:61args
rule "expr fn body"fns.rs:89borrow_check failednll.rs:124args
rule "borrow_check"nll.rs:135borrow_check_block failednll.rs:142rule "basic block"nll.rs:157borrow_check_statement failednll.rs:174args
rule "expr"nll.rs:232borrow_check_expr failednll.rs:371args
rule "call"nll.rs:455borrow_check_expr failednll.rs:371args
rule "turbofish"nll.rs:566borrow_check_fn_ref failednll.rs:616args
rule "fn-ref"nll.rs:632prove failedfunction.rs:250args
rulefunction.rs:250prove_predicate_list failedprove_predicate_list.rs:8args
rule "some"prove_predicate_list.rs:26prove_predicate failedprove_predicate.rs:22args
rule "trait implied bound"prove_predicate.rs:106 (failed: empty_collection)