Negative coverage: check_crate_item / free fn / premise check_free_fn(program, f, crate_id) => ()
Premise at line 208. Observed failure causes: failed_judgment.
free fn| Line | Coverage | Source |
|---|---|---|
| 208 | 116 | (check_free_fn(program, f, crate_id) => ()) |
| ──────── ("free fn") | ||
| 210 | 291 | (check_crate_item(program, CrateItem::Fn(f), crate_id) => ()) |
116 tests failed proving this premise:
Source location: src/test_util.rs:464 (all coverage from this test)
#[test]
fn borrowck_err_checks_rustc_err_once() {
let before = rustc_runs();
FormalityTest::new(MOVED)
.rustc_err(expect_test::expect![[r#"
error[E0382]: use of moved value: `x`
--> lib.rs
|
6 | let mut x: Datum = Datum { value: 0_u32 };
| ----- move occurs because `x` has type `Datum`, which does not implement the `Copy` trait
7 | let mut y: Datum = x;
| - value moved here
8 | let mut z: Datum = x;
| ^ value used here after move
|
note: if `Datum` implemented `Clone`, you could clone the value
--> lib.rs
|
1 | pub struct Datum {
| ^^^^^^^^^^^^^^^^ consider implementing `Clone` for this type
...
7 | let mut y: Datum = x;
| - you could clone this value
For more information about this error, try `rustc --explain E0382`.
error: could not compile `Foo` (lib) due to 1 previous error
"#]])
.borrowck_err(BorrowCheckFailure::All, expect_test::expect![[r#"
the rule "access_permitted" at (nll.rs) failed because
condition evaluated to false: `match access.kind
{
AccessKind::Write =>
check_place_writable(&state, &access.place.to_place_expression()),
AccessKind::Read | AccessKind::Move =>
check_place_initialized(&state, &access.place.to_place_expression()),
}`"#]]);
assert_eq!(rustc_runs() - before, 1);
}
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:75check_crate_item failedmod.rs:180rule "free fn"mod.rs:208check_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:144rule "basic block"nll.rs:159borrow_check_statement failednll.rs:176args
rule "let"nll.rs:191borrow_check_expr_has_ty failednll.rs:354args
rule "block"nll.rs:367borrow_check_expr failednll.rs:375args
rule "place"nll.rs:585access_permitted failednll.rs:900args
rule "access_permitted"nll.rs:912 (failed: if_false)
Source location: src/test_util.rs:479 (all coverage from this test)
#[test]
#[should_panic(expected = "expected `rustc` to succeed but it failed")]
fn borrowck_err_enforces_rustc_ok() {
FormalityTest::new(MOVED).rustc_ok().borrowck_err(
BorrowCheckFailure::All,
expect_test::expect![[r#"
the rule "access_permitted" at (nll.rs) failed because
condition evaluated to false: `match access.kind
{
AccessKind::Write =>
check_place_writable(&state, &access.place.to_place_expression()),
AccessKind::Read | AccessKind::Move =>
check_place_initialized(&state, &access.place.to_place_expression()),
}`"#]],
);
}
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:75check_crate_item failedmod.rs:180rule "free fn"mod.rs:208check_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:144rule "basic block"nll.rs:159borrow_check_statement failednll.rs:176args
rule "let"nll.rs:191borrow_check_expr_has_ty failednll.rs:354args
rule "block"nll.rs:367borrow_check_expr failednll.rs:375args
rule "place"nll.rs:585access_permitted failednll.rs:900args
rule "access_permitted"nll.rs:912 (failed: if_false)
Source location: src/test_util.rs:516 (all coverage from this test)
#[test]
fn rustc_expectation_is_independent_of_borrowck_modes() {
let before = rustc_runs();
FormalityTest::new(NLL_ONLY_ERROR)
.rustc_err(expect_test::expect![[r#"
error[E0499]: cannot borrow `*m` as mutable more than once at a time
--> lib.rs
|
3 | pub fn foo<'a00>(mut m: &'a00 mut Map) -> &'a00 mut Map {
| ---- lifetime `'a00` defined here
4 | {
5 | let mut n: &'_ mut Map = &mut *m;
| ------- first mutable borrow occurs here
6 | if false {
7 | return n;
| - returning this value requires that `*m` is borrowed for `'a00`
8 | } else {
9 | let mut o: &'_ mut Map = &mut *m;
| ^^^^^^^ second mutable borrow occurs here
For more information about this error, try `rustc --explain E0499`.
error: could not compile `Foo` (lib) due to 1 previous error
"#]])
.borrowck_err(BorrowCheckFailure::Nll, expect_test::expect![[r#"
the rule "borrow of disjoint places" at (nll.rs) failed because
condition evaluated to false: `place_disjoint_from_place(&loan.place, &access.place)`
&loan.place = *(m : &!lt_1 mut Map) : <&!lt_1 mut Map as Derefable>::Target
&access.place = *(m : &!lt_1 mut Map) : <&!lt_1 mut Map as Derefable>::Target
the rule "loan_cannot_outlive" at (nll.rs) failed because
condition evaluated to false: `!outlived_by_loan.contains(&lifetime.upcast())`
outlived_by_loan = {!lt_1, ?lt_2, ?lt_3}
&lifetime.upcast() = !lt_1
the rule "loan_not_required_by_universal_regions" at (nll.rs) failed because
condition evaluated to false: `outlived_by_loan.iter().all(|p| match p
{
Parameter::Ty(_) => false, Parameter::Lt(lt) => match lt.as_ref()
{
Lt::Static => false, Lt::Variable(Variable::UniversalVar(_)) => false,
Lt::Variable(Variable::ExistentialVar(_)) => true,
Lt::Variable(Variable::BoundVar(_)) =>
panic!("cannot outlive a bound var"), Lt::Erased => true,
}, Parameter::Const(_) => panic!("cannot outlive a constant"),
})`
the rule "write-indirect" at (nll.rs) failed because
pattern `TypedPlaceExpressionData::Deref(place_loaned_ref)` did not match value `m`
the rule "write-indirect" at (nll.rs) failed because
condition evaluated to false: `place_accessed.is_prefix_of(place_loaned_ref)`
place_accessed = *(m : &!lt_1 mut Map) : <&!lt_1 mut Map as Derefable>::Target
place_loaned_ref = m : &!lt_1 mut Map"#]]);
assert_eq!(rustc_runs() - before, 1);
}
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:75check_crate_item failedmod.rs:180rule "free fn"mod.rs:208check_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:144rule "basic block"nll.rs:159borrow_check_statement failednll.rs:176args
rule "exists"nll.rs:334borrow_check_block failednll.rs:144args
rule "basic block"nll.rs:159borrow_check_statement failednll.rs:176args
rule "if"nll.rs:225borrow_check_block failednll.rs:144args
rule "basic block"nll.rs:159borrow_check_statement failednll.rs:176args
rule "let"nll.rs:191borrow_check_expr_has_ty failednll.rs:354rule "block"nll.rs:367borrow_check_expr failednll.rs:375rule "ref"nll.rs:559access_permitted failednll.rs:900rule "access_permitted"nll.rs:916access_permitted_by_loans failednll.rs:923rule "access_permitted_by_loans"nll.rs:936access_permitted_by_loan failednll.rs:943args
rule "borrow of disjoint places"nll.rs:958 (failed: if_false)rule "loan is dead"nll.rs:1005loan_not_required_by_live_places failednll.rs:1356rule "loan_not_required_by_live_places"nll.rs:1381loan_not_required_by_live_place failednll.rs:1388args
rule "loan is not required by type"nll.rs:1408loan_not_required_by_parameter failednll.rs:1456args
rule "rigid-ty"nll.rs:1476loan_not_required_by_parameters failednll.rs:1593args
rule "loan_not_required_by_parameters"nll.rs:1614loan_not_required_by_parameter failednll.rs:1456args
rule "lifetime"nll.rs:1566loan_cannot_outlive failednll.rs:1573args
rule "loan_cannot_outlive"nll.rs:1586 (failed: if_false)
rule "universal-variable"nll.rs:1550loan_cannot_outlive_universal_regions failednll.rs:1300args
rule "loan_not_required_by_universal_regions"nll.rs:1327 (failed: if_false)
rule "write-indirect"nll.rs:985 (failed: if_let)rule "write-indirect"nll.rs:987 (failed: if_false)
Source location: tests/borrowck.rs:124 (all coverage from this test)
fn foo() -> u32 {
let x: u32;
return x;
}
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:75check_crate_item failedmod.rs:180rule "free fn"mod.rs:208check_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:144rule "basic block"nll.rs:159borrow_check_statement failednll.rs:176args
rule "return"nll.rs:284borrow_check_expr failednll.rs:375args
rule "place"nll.rs:585access_permitted failednll.rs:900args
rule "access_permitted"nll.rs:912 (failed: if_false)
rule "place"nll.rs:585access_permitted failednll.rs:900args
rule "access_permitted"nll.rs:912 (failed: if_false)
Source location: tests/borrowck.rs:172 (all coverage from this test)
fn foo() -> Datum {
let x: Datum = Datum { value: 0_u32 };
let y: Datum = x;
let z: Datum = x;
return z;
}
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:75check_crate_item failedmod.rs:180rule "free fn"mod.rs:208check_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:144rule "basic block"nll.rs:159borrow_check_statement failednll.rs:176args
rule "let"nll.rs:191borrow_check_expr_has_ty failednll.rs:354args
rule "block"nll.rs:367borrow_check_expr failednll.rs:375args
rule "place"nll.rs:585access_permitted failednll.rs:900args
rule "access_permitted"nll.rs:912 (failed: if_false)
Source location: tests/borrowck.rs:240 (all coverage from this test)
fn foo() -> u32 {
let x: u32;
if true {
x = 1_u32;
} else {
}
return x;
}
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:75check_crate_item failedmod.rs:180rule "free fn"mod.rs:208check_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:144rule "basic block"nll.rs:159borrow_check_statement failednll.rs:176args
rule "return"nll.rs:284borrow_check_expr failednll.rs:375args
rule "place"nll.rs:585access_permitted failednll.rs:900args
rule "access_permitted"nll.rs:912 (failed: if_false)
rule "place"nll.rs:585access_permitted failednll.rs:900args
rule "access_permitted"nll.rs:912 (failed: if_false)
Source location: tests/borrowck.rs:342 (all coverage from this test)
fn foo() -> u32 {
let x: u32;
if true {
x = 1_u32;
}
return x;
}
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:75check_crate_item failedmod.rs:180rule "free fn"mod.rs:208check_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:144rule "basic block"nll.rs:159borrow_check_statement failednll.rs:176args
rule "return"nll.rs:284borrow_check_expr failednll.rs:375args
rule "place"nll.rs:585access_permitted failednll.rs:900args
rule "access_permitted"nll.rs:912 (failed: if_false)
rule "place"nll.rs:585access_permitted failednll.rs:900args
rule "access_permitted"nll.rs:912 (failed: if_false)
Source location: tests/borrowck.rs:393 (all coverage from this test)
fn foo() -> Datum {
let x: Datum = Datum { value: 0_u32 };
if true {
let y: Datum = x;
}
let z: Datum = x;
return z;
}
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:75check_crate_item failedmod.rs:180rule "free fn"mod.rs:208check_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:144rule "basic block"nll.rs:159borrow_check_statement failednll.rs:176args
rule "let"nll.rs:191borrow_check_expr_has_ty failednll.rs:354args
rule "block"nll.rs:367borrow_check_expr failednll.rs:375args
rule "place"nll.rs:585access_permitted failednll.rs:900args
rule "access_permitted"nll.rs:912 (failed: if_false)
Source location: tests/borrowck.rs:446 (all coverage from this test)
fn foo() -> u32 {
let x: Pair;
x.first = 1_u32;
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:75check_crate_item failedmod.rs:180rule "free fn"mod.rs:208check_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:144rule "basic block"nll.rs:159borrow_check_statement failednll.rs:176args
rule "expr"nll.rs:234borrow_check_expr failednll.rs:375args
rule "assign"nll.rs:455access_permitted failednll.rs:900args
rule "access_permitted"nll.rs:912 (failed: if_false)
Source location: tests/borrowck.rs:532 (all coverage from this test)
fn foo() -> u32 {
let x: Pair = Pair {
first: Datum { value: 1_u32 },
second: Datum { value: 2_u32 },
};
let a: Datum = x.first;
let b: Pair = x;
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:75check_crate_item failedmod.rs:180rule "free fn"mod.rs:208check_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:144rule "basic block"nll.rs:159borrow_check_statement failednll.rs:176args
rule "let"nll.rs:191borrow_check_expr_has_ty failednll.rs:354args
rule "block"nll.rs:367borrow_check_expr failednll.rs:375args
rule "place"nll.rs:585access_permitted failednll.rs:900args
rule "access_permitted"nll.rs:912 (failed: if_false)
Source location: tests/borrowck.rs:580 (all coverage from this test)
fn foo() -> Datum {
let x: Pair = Pair {
first: Datum { value: 1_u32 },
second: Datum { value: 2_u32 },
};
let a: Datum = x.first;
let b: Datum = x.first;
return b;
}
Proof trees omitted for the remaining 106 tests; each one is on its test’s page in Coverage by test.
Source location: tests/borrowck.rs:628 (all coverage from this test)
fn foo() -> Datum {
let x: Pair = Pair {
first: Datum { value: 1_u32 },
second: Datum { value: 2_u32 },
};
let a: Pair = x;
let b: Datum = x.first;
return b;
}
Source location: tests/borrowck.rs:672 (all coverage from this test)
fn foo() -> u32 {
let x: Outer = Outer {
foo: Inner { bar: 1_u32 },
};
let a: Inner = x.foo;
let b: u32 = x.foo.bar;
return b;
}
Source location: tests/borrowck.rs:721 (all coverage from this test)
fn foo() -> Datum {
exists<'r0, 'r1> {
let x: Datum = Datum { value: 0_u32 };
let r: &'r0 Datum = &'r1 x;
let y: Datum = *r;
return y;
}
}
Source location: tests/borrowck.rs:1476 (all coverage from this test)
fn foo() -> Datum {
exists<'r0, 'r1> {
let x: Datum = Datum { value: 0_u32 };
let r: &'r0 mut Datum = &'r1 mut x;
let y: Datum = *r;
return y;
}
}
Source location: tests/borrowck.rs:2232 (all coverage from this test)
fn foo() -> Datum {
exists<'r0, 'r1> {
let x: Datum = Datum { value: 0_u32 };
let r: &'r0 Datum = &'r1 x;
let y: Datum = x;
return *r;
}
}
Source location: tests/borrowck.rs:2301 (all coverage from this test)
fn foo() -> u32 {
let x: u32;
return x;
}
Source location: tests/borrowck.rs:2347 (all coverage from this test)
fn foo() -> i32 {
exists<'r0, 'r1> {
let v1: i32 = 0_i32;
let v2: &'r0 mut i32 = &'r1 mut v1;
// This should result in an error
v1 = 1_i32;
return *v2;
}
}
Source location: tests/borrowck.rs:2385 (all coverage from this test)
fn foo() -> i32 {
exists<'r0, 'r1> {
let v1: i32 = 0_i32;
let v2: &'r0 i32 = &'r1 v1;
v1 = 1_i32;
return *v2;
}
}
Source location: tests/borrowck.rs:2419 (all coverage from this test)
fn foo() -> i32 {
exists<'r> {
let v3: i32 = 0_i32;
let v4: &'r i32 = &'r v3;
}
exists<'r0, 'r1> {
let v1: i32 = 0_i32;
let v2: &'r0 i32 = &'r1 v1;
v1 = 1_i32;
return *v2;
}
}
Source location: tests/borrowck.rs:2470 (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;
}
}
}
Source location: tests/borrowck.rs:2531 (all coverage from this test)
fn foo() -> i32 {
exists<'r0, 'r1> {
let v2: &'r0 i32;
{
let v1: i32 = 0_i32;
v2 = &'r1 v1;
}
return *v2;
}
}
Source location: tests/borrowck.rs:2603 (all coverage from this test)
fn foo() -> i32 {
exists<'r0, 'r1> {
let v2: &'r0 mut i32;
{
let v1: i32 = 0_i32;
v2 = &'r1 mut v1;
}
return *v2;
}
}
Source location: tests/borrowck.rs:2645 (all coverage from this test)
fn foo() -> i32 {
exists<'r0, 'r1> {
let v2: &'r0 i32;
'a: {
let v1: i32 = 0_i32;
v2 = &'r1 v1;
break 'a;
}
return *v2;
}
}
Source location: tests/borrowck.rs:2681 (all coverage from this test)
fn dangling<'a>() -> &'a u32 {
let x: u32 = 22_u32;
exists<'r0> {
return &'r0 x;
}
}
Source location: tests/borrowck.rs:2726 (all coverage from this test)
fn dangling<'a>(x: u32) -> &'a u32 {
exists<'r0> {
return &'r0 x;
}
}
Source location: tests/borrowck.rs:2782 (all coverage from this test)
fn store(x: u32) -> () {
exists<'r0> {
stash(&'r0 x);
}
}
Source location: tests/borrowck.rs:2901 (all coverage from this test)
fn foo<'a, 'b>(v1: &'a u32) -> &'b u32 {
exists<'r0> {
let v2: &'r0 u32 = v1;
return v2;
}
}
Source location: tests/borrowck.rs:2931 (all coverage from this test)
fn foo<'a, 'b>(v1: &'a u32, v2: &'b u32) -> () {
let output: &'b u32 = v2;
loop {
output = v1;
}
}
Source location: tests/borrowck.rs:2996 (all coverage from this test)
fn foo<'a, 'b, 'c>(v1: &'a u32) -> &'c u32
where
'a: 'b,
{
return v1;
}
Source location: tests/borrowck.rs:3180 (all coverage from this test)
fn foo() -> i32 {
exists<'r0, 'r1> {
let r: &'r0 i32;
'a: loop {
let y: i32 = 0_i32;
r = &'r1 y;
continue 'a;
}
r; // only an error because of false edges, assumption that all loops terminate
}
}
Source location: tests/borrowck.rs:3227 (all coverage from this test)
fn foo() -> i32 {
exists<'r0, 'r1> {
let x: i32 = 0_i32;
let r: &'r0 i32;
'a: loop {
r; // this *may* read from `y` in a previous iteration
let y: i32 = 0_i32;
r = &'r1 y;
continue 'a;
}
}
}
Source location: tests/borrowck.rs:3297 (all coverage from this test)
fn foo() -> i32 {
exists<'r0, 'r1> {
let r: &'r0 i32;
'a: loop {
let x: i32 = 0_i32;
r = &'r1 x;
break 'a;
}
return *r;
}
}
Source location: tests/borrowck.rs:3424 (all coverage from this test)
fn foo() -> u32 {
exists<'r0, 'r1> {
let a: u32 = 22_u32;
let p: &'r0 u32 = &'r1 a;
'l: loop {
if true {
a = 23_u32;
continue 'l;
} else {
break 'l;
}
}
return *p;
}
}
Source location: tests/borrowck.rs:3485 (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;
}
}
}
Source location: tests/borrowck.rs:3549 (all coverage from this test)
fn foo() -> u32 {
exists<'r0, 'r1, 'r2> {
let a: u32 = 22_u32;
let b: u32 = 22_u32;
let p: &'r0 u32 = &'r1 a;
a = 23_u32;
'l: loop {
p = &'r2 b;
break 'l;
}
return *p;
}
}
Source location: tests/borrowck.rs:3667 (all coverage from this test)
fn foo<'a, 'b>(a: &'a u32) -> &'b u32 {
let r: &'b u32 = identity::<&'b u32>(a);
return r;
}
Source location: tests/borrowck.rs:3733 (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;
}
}
Source location: tests/borrowck.rs:3781 (all coverage from this test)
fn foo() -> u32 {
exists<'r0, 'r1> {
let p: Point = Point { x: 0_u32, y: 0_u32 };
let b1: &'r0 mut u32 = &'r1 mut p.x;
p.x = 1_u32;
return *b1;
}
}
Source location: tests/borrowck.rs:3815 (all coverage from this test)
fn foo() -> u32 {
exists<'r0, 'r1> {
let v1: u32 = 22_u32;
let v2: &'r0 mut u32 = &'r1 mut v1;
let w: Wrapper = Wrapper { value: v1 };
return *v2;
}
}
Source location: tests/borrowck.rs:3855 (all coverage from this test)
fn foo() -> u32 {
exists<'r0> {
let v1: u32 = 0_u32;
let w: Wrapper<'r0> = Wrapper::<'r0> { value: &'r0 mut v1 };
v1 = 1_u32;
return *(w.value);
}
}
Source location: tests/borrowck.rs:3912 (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;
}
}
Source location: tests/borrowck.rs:4010 (all coverage from this test)
fn foo() -> u32 {
exists<'r0, 'r1, 'r2> {
let x: u32 = 22_u32;
let p: &'r1 u32 = &'r0 x;
let q: &'r2 u32 = p;
x = 1_u32;
q;
return 0_u32;
}
}
Source location: tests/borrowck.rs:4088 (all coverage from this test)
fn foo(f: Pair) -> () {
let s: Datum = f.x;
}
Source location: tests/borrowck.rs:4204 (all coverage from this test)
fn foo() -> u32 {
exists<'r0, 'r1> {
let x: u32 = 22_u32;
let helper: &'r1 u32 = &'r0 x;
x = 1_u32;
helper;
return 0_u32;
}
}
Source location: tests/borrowck.rs:4232 (all coverage from this test)
fn foo<'a, 'b>(p: &'a mut u32) -> u32 {
let q: &'b mut u32 = &'b mut *p;
q;
return 0_u32;
}
Source location: tests/borrowck.rs:4411 (all coverage from this test)
fn remove_last_node_iterative<'a>(node: &'a mut List) -> u32 {
exists<'r0, 'r1> {
let cursor: &'r0 mut List = &'r0 mut *node;
'l: loop {
let next: &'r1 mut List = &'r1 mut *cursor;
if true {
cursor = next;
} else {
break 'l;
}
}
*cursor = List { value: 0_u32 };
return 0_u32;
}
}
Source location: tests/borrowck.rs:4523 (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;
}
}
Source location: tests/borrowck.rs:4789 (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 {
}
}
}
}
Source location: tests/borrowck.rs:4912 (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>();
}
}
Source location: tests/borrowck.rs:5028 (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:5059 (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;
}
}
Source location: tests/borrowck.rs:5249 (all coverage from this test)
fn foo() -> () {
let x: u32 = 1_u32;
exists<'r0> {
let r: &'r0 u32 = &'r0 x;
x += 1_u32;
let y: u32 = *r;
}
}
Source location: tests/borrowck.rs:5293 (all coverage from this test)
fn foo() -> () {
let x: u32;
x += 1_u32;
}
Source location: tests/borrowck.rs:5346 (all coverage from this test)
fn foo() -> () {
let x: u32 = 1_u32;
exists<'a> {
let r: &'a mut u32 = &'a mut x;
x = x + *r;
}
}
Source location: tests/borrowck.rs:5398 (all coverage from this test)
fn foo() -> () {
let x: u32 = 1_u32;
exists<'a> {
let r: &'a mut u32 = &'a mut x;
x += *r;
let y: u32 = *r;
}
}
Source location: tests/borrowck.rs:5450 (all coverage from this test)
fn foo() -> () {
let x: u32 = 1_u32;
exists<'a> {
let r: &'a mut u32 = &'a mut x;
*r += x;
}
}
Source location: tests/borrowck.rs:5506 (all coverage from this test)
fn f() -> u32 {
exists<'r0, 'r1> {
let v: u32 = 0_u32;
let r: &'r0 u32 = &'r0 v;
let x: u32 = pair::<'r1, 'r0>(&'r1 mut v, r);
return x;
}
}
Source location: tests/borrowck.rs:5555 (all coverage from this test)
fn f() -> u32 {
exists<'r0, 'r1> {
let v: u32 = 0_u32;
let r: &'r0 u32 = &'r0 v;
let p: Pair<'r1, 'r0> = Pair::<'r1, 'r0> { a: &'r1 mut v, b: r };
return 0_u32;
}
}
Source location: tests/borrowck.rs:5694 (all coverage from this test)
fn main() -> () {
let v0: u32 = 0_u32;
exists<'a, 'b> {
let p: &'a u32 = &'a v0;
let q: &'b u32;
exists<'r> {
let m: &'r u32 = p;
q = m;
}
v0 = 1_u32;
let z: u32 = *q;
}
}
Source location: tests/borrowck.rs:5742 (all coverage from this test)
fn main() -> () {
let v0: u32 = 0_u32;
exists<'b> {
let q: &'b u32;
exists<'r> {
let m: &'r u32 = &'r v0;
q = m;
}
v0 = 1_u32;
let z: u32 = *q;
}
}
Source location: tests/borrowck.rs:5782 (all coverage from this test)
fn main() -> () {
let v0: u32 = 0_u32;
exists<'b1, 'b2> {
let q1: &'b1 u32;
let q2: &'b2 u32;
exists<'r> {
let m: &'r u32 = &'r v0;
q1 = m;
q2 = m;
}
let z1: u32 = *q1;
v0 = 1_u32;
let z2: u32 = *q2;
}
}
Source location: tests/borrowck.rs:5878 (all coverage from this test)
fn foo() -> () {
let x: u32 = 1_u32;
exists<'a> {
let r: &'a mut u32 = &'a mut x;
let y: u32 = x | *r;
}
}
Source location: tests/borrowck.rs:5930 (all coverage from this test)
fn foo() -> () {
let x: u32 = 1_u32;
exists<'a> {
let r: &'a mut u32 = &'a mut x;
let y: u32 = x;
let z: u32 = 1_u32 | *r;
}
}
Source location: tests/borrowck.rs:5984 (all coverage from this test)
fn foo() -> () {
let x: u32 = 6_u32;
exists<'a> {
let r: &'a mut u32 = &'a mut x;
let y: u32 = x & *r;
}
}
Source location: tests/consts.rs:149 (all coverage from this test)
Source location: tests/consts.rs:242 (all coverage from this test)
Source location: tests/higher_ranked_where_clauses.rs:87 (all coverage from this test)
fn foo<'b, T>() -> () where T: Trait<'b> {
needs_all::<T>();
}
Source location: tests/higher_ranked_where_clauses.rs:151 (all coverage from this test)
fn foo<T>() -> u32 where for<'a> T: Trait<'a> {
let v: u32 = 1_u32;
exists<'r> {
let r: &'r u32 = first::<'r, T>(&'r v);
v = 2_u32;
return *r;
}
}
Source location: tests/mir_typeck.rs:168 (all coverage from this test)
fn foo (b: bool) -> u32 {
if b {
return 1_u32;
} else {
return false;
}
}
Source location: tests/mir_typeck.rs:321 (all coverage from this test)
fn foo() -> () {
let s2: S2<S1>;
}
Source location: tests/mir_typeck.rs:345 (all coverage from this test)
fn bar() -> u32 {
let v1: u32 = foo(0_u32);
return v1;
}
Source location: tests/mir_typeck.rs:392 (all coverage from this test)
fn bar(v1: ()) -> () {
let v0: () = foo(v1);
return v0;
}
Source location: tests/mir_typeck.rs:416 (all coverage from this test)
fn bar(v1: u32) -> u32 {
let v0: u32 = identity(v1);
return v0;
}
Source location: tests/mir_typeck.rs:488 (all coverage from this test)
fn bar(v1: u32) -> u32 {
let v0: u32 = identity::<bool>(v1);
return v0;
}
Source location: tests/mir_typeck.rs:532 (all coverage from this test)
fn bar(v1: u32) -> u32 {
let v0: u32 = identity::<u32>(v1, v1);
return v0;
}
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;
}
Source location: tests/mir_typeck.rs:601 (all coverage from this test)
fn foo (v1: ()) -> u32 {
return v1;
}
Source location: tests/mir_typeck.rs:791 (all coverage from this test)
fn foo (v1: u32) -> u32 {
let v2: Dummy = Dummy { value: 1_u32 };
v2.nonexistent = 2_u32;
return v1;
}
Source location: tests/mir_typeck.rs:820 (all coverage from this test)
fn foo (v1: u32) -> u32 {
let v2: Dummy = Dummy { value: 1_u32 };
v1.value = 2_u32;
return v1;
}
Source location: tests/mir_typeck.rs:848 (all coverage from this test)
fn foo (v1: u32) -> u32 {
let v2: Dummy = Dummy { value: false };
return v1;
}
Source location: tests/mir_typeck.rs:876 (all coverage from this test)
fn foo (v1: u32) -> u32 {
let v2: u32 = Nonexistent { value: false };
return v1;
}
Source location: tests/mir_typeck.rs:902 (all coverage from this test)
fn main() -> () {
let s: S = S { x: 1_u32, x: 2_u32 };
}
Source location: tests/mir_typeck.rs:1046 (all coverage from this test)
fn foo() -> u32 {
loop {
break 'nonexistent;
}
return 0_u32;
}
Source location: tests/mir_typeck.rs:1109 (all coverage from this test)
fn foo() -> u32 {
'a: {
continue 'a;
}
return 0_u32;
}
Source location: tests/mir_typeck.rs:1218 (all coverage from this test)
fn foo() -> () {
let x: i32 = 1_i32 + 2_u32;
}
Source location: tests/mir_typeck.rs:1270 (all coverage from this test)
fn foo() -> () {
let x: i32 = 10_i32 - 3_u32;
}
Source location: tests/mir_typeck.rs:1323 (all coverage from this test)
fn foo() -> () {
let x: i32 = 3_i32 * 4_u32;
}
Source location: tests/mir_typeck.rs:1349 (all coverage from this test)
fn foo() -> () {
let x: bool = true * false;
}
Source location: tests/mir_typeck.rs:1405 (all coverage from this test)
fn foo() -> () {
let x: i32 = 7_i32 % 3_u32;
}
Source location: tests/mir_typeck.rs:1431 (all coverage from this test)
fn foo() -> () {
let x: bool = true % false;
}
Source location: tests/mir_typeck.rs:1484 (all coverage from this test)
fn foo() -> () {
let x: i32 = 3_i32 ^ 4_u32;
}
Source location: tests/mir_typeck.rs:1532 (all coverage from this test)
fn main() -> () {
let x: u32 = 12_u32;
x ^= 3_i32;
}
Source location: tests/mir_typeck.rs:1547 (all coverage from this test)
fn foo() -> () {
let x: bool = true ^ false;
}
Source location: tests/mir_typeck.rs:1600 (all coverage from this test)
fn foo() -> () {
let x: i32 = 3_i32 | 4_u32;
}
Source location: tests/mir_typeck.rs:1648 (all coverage from this test)
fn main() -> () {
let x: u32 = 12_u32;
x |= 3_i32;
}
Source location: tests/mir_typeck.rs:1663 (all coverage from this test)
fn foo() -> () {
let x: bool = true | false;
}
Source location: tests/mir_typeck.rs:1716 (all coverage from this test)
fn foo() -> () {
let x: i32 = 3_i32 & 4_u32;
}
Source location: tests/mir_typeck.rs:1764 (all coverage from this test)
fn main() -> () {
let x: u32 = 12_u32;
x &= 3_i32;
}
Source location: tests/mir_typeck.rs:1779 (all coverage from this test)
fn foo() -> () {
let x: bool = true & false;
}
Source location: tests/mir_typeck.rs:1824 (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;
}
Source location: tests/mir_typeck.rs:1868 (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;
}
Source location: tests/mir_typeck.rs:1944 (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;
}
Source location: tests/mir_typeck.rs:1989 (all coverage from this test)
fn foo() -> () {
let x: u32 = 1_u32;
x += 2_u8;
}
Source location: tests/mir_typeck.rs:2016 (all coverage from this test)
fn foo() -> () {
let x: bool = true;
x += false;
}
Source location: tests/mir_typeck.rs:2035 (all coverage from this test)
fn main() -> () {
needs_all();
}
Source location: tests/mir_typeck.rs:2101 (all coverage from this test)
fn main() -> () {
let v0: u32 = 0_u32;
exists<'r> {
let v1: &'r u32 = &'r v0;
needs_all::<&'r u32>(v1);
v0 = 1_u32;
}
}
Source location: tests/mir_typeck.rs:2207 (all coverage from this test)
fn caller<'x>(v: &'x u32) -> () {
needs_all::<&'x u32>(v);
}
Source location: tests/mir_typeck.rs:2237 (all coverage from this test)
fn main() -> () {
let v0: u32 = 0_u32;
exists<'r> {
let v1: &'r u32 = &'r v0;
needs_all::<&'r u32>(v1);
}
}
Source location: tests/mir_typeck.rs:2249 (all coverage from this test)
fn foo() -> () {
let x: i32 = 12_i32 / 3_u32;
}
Source location: tests/mir_typeck.rs:2262 (all coverage from this test)
fn foo() -> () {
let x: bool = true / false;
}
Source location: tests/pr502_liveness_prototypes.rs:56 (all coverage from this test)
fn f() -> () {
exists<'r0, 'r1> {
let v: u32 = 0_u32;
let r: &'r0 u32 = &'r0 v;
pair::<'r1, 'r0>(&'r1 mut v, identity::<'r0>(r));
}
}
Source location: tests/pr502_liveness_prototypes.rs:100 (all coverage from this test)
fn f() -> () {
exists<'r0, 'r1> {
let v: u32 = 0_u32;
let r: &'r0 u32 = &'r0 v;
let p: Pair<'r1> = Pair::<'r1> { b: &'r1 mut v, a: *r };
}
}
Source location: tests/pr502_liveness_prototypes.rs:164 (all coverage from this test)
fn f() -> u32 {
exists<'r0, 'r1> {
let v: u32 = 0_u32;
let r: &'r0 u32 = &'r0 v;
touch::<'r1>(&'r1 mut v);
return *r;
}
}
Source location: tests/references.rs:13 (all coverage from this test)
Source location: tests/sized_trait.rs:464 (all coverage from this test)
fn forward<T>(value: Tail<T>) -> () { consume::<Tail<T>>(value); }
}])
tc_ok()
(expect_test::expect![[r#"
crates/formality-rust/src/prove/prove_sized.rs:12:1: no applicable rules for prove_sized { ty: !ty_0, assumptions: {}, env: Env { variables: [!ty_0], bias: Soundness, pending: [], allow_pending_outlives: true } }
the rule "trait implied bound" at (prove_predicate.rs) failed because
expression evaluated to an empty collection: `decls.trait_invariants()`
the rule "trait implied bound" at (prove_predicate.rs) failed because
expression evaluated to an empty collection: `decls.trait_invariants()`"#]]);
}
#540: use the associated-type Sized bound; remove should_panic when fixed.
#[test]
_panic(expected = "prove_sized { ty: <!ty_0 as Tr>::A")]
iated_sized_bound_allows_nonfinal_struct_field() {
program = crates![crate Foo {
trait Tr { type A: [Sized]; }
struct S<T> where T: Tr { first: <T as Tr>::A, last: u32 }
fn main() -> () {}
}];
heck rustc before the expected formality failure.
(ok, stderr) = formality_rust::to_rust::test_util::run_rustc(&program);
rt!(ok, "{stderr}");
alityTest::new(program).rustc_ok().ok();
}
#540: use the associated-type Sized bound; remove should_panic when fixed.
#[test]
_panic(expected = "prove_sized { ty: <!ty_0 as Tr>::A")]
iated_sized_bound_allows_enum_field() {
program = crates![crate Foo {
trait Tr { type A: [Sized]; }
enum E<T> where T: Tr { Some { value: <T as Tr>::A }, None {} }
fn main() -> () {}
}];
heck rustc before the expected formality failure.
(ok, stderr) = formality_rust::to_rust::test_util::run_rustc(&program);
rt!(ok, "{stderr}");
alityTest::new(program).rustc_ok().ok();
}
#[test]
d_struct_sized_bound_executes() {
alityTest::new(crates![crate Foo {
struct Tail<T> { prefix: u32, tail: T }
struct Outer<T> { inner: Tail<T> }
fn consume<T>(value: T) -> u32 where T: Sized { return 7_u32; }
fn main() -> () {
println!(consume::<Outer<u32>>(Outer::<u32> {
inner: Tail::<u32> { prefix: 1_u32, tail: 2_u32 }
}));
}