Negative coverage: borrow_check_fn_ref / fn-ref / premise prove_where_clauses(env, assumptions, state, where_clauses) => state
Premise at line 632. Observed failure causes: failed_judgment.
fn-ref| Line | Coverage | Source |
|---|---|---|
| 629 | 1 | (let Fn { binder, .. } = env.crates().fn_named(id)?) |
| 630 | 2 | (if binder.len() == args.len()) |
| 631 | ✗ | (let FnBoundData { where_clauses, .. } = binder.instantiate_with(args)?) |
| 632 | 5 | (prove_where_clauses(env, assumptions, state, where_clauses) => state) |
| 633 | N/A | (let ty = Ty::rigid(RigidName::fn_def(id), args)) |
| ──────── ("fn-ref") | ||
| 635 | 43 | (borrow_check_fn_ref(env, assumptions, state, id, args) => (ty, state)) |
5 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:1394 (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()`"#]]);
}
ing the same function is still rejected. The where-clauses are now
ked both for the function name and by the call.
#[test]
generic_fn_call_with_unsatisfied_where_clause() {
alityTest::new(crates![crate test {
trait Marker {}
struct S {}
fn require_marker<T>() -> () where T: Marker { trusted }
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 "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)
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)
Source location: tests/mir_typeck.rs:1514 (all coverage from this test)
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 "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 "outlives"prove_predicate.rs:142prove_outlives failedprove_outlives.rs:8args