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

Test main

Source location: tests/borrowck.rs:23

fn main() -> () { println!(1_u32); }
}])
cution_step_limit(10)
rowck_ok();
}

#[test]
tion_limit_skipped_execution_needs_no_steps() {
program = crates![crate Foo {
fn example() -> () {}
}];

alityTest::new(program)
.execution_step_limit(0)
.skip_execute()
.borrowck_ok();
}

#[test]
tion_limit_default_allowance_runs_small_programs() {
program = crates![crate Foo {
fn main() -> () { println!(1_u32); }
}];
alityTest::new(program)
.expect_output("1\n")
.borrowck_ok();
}

#[test]
tion_limit_borrowck_finishes_on_last_allowed_step() {
alityTest::new(crates![crate Foo {
fn main() -> () { println!(1_u32); }
}])
cution_step_limit(11)
ect_output("1\n")
rowck_ok();
}

#[test]
_panic(expected = "execution step limit reached after 0 steps")]
tion_limit_borrowck_zero_allowance_prevents_execution() {
alityTest::new(crates![crate Foo {
fn main() -> () { println!(1_u32); }
}])
cution_step_limit(0)
rowck_ok();
}

#[test]
_panic(expected = "program output mismatch")]
wck_checks_output_expectation() {
alityTest::new(crates![crate Foo {
fn main() -> () { println!(1_u32); }
}])
ect_output("999\n")
rowck_ok();
}

#[test]
wck_accepts_matching_output() {
alityTest::new(crates![crate Foo {
fn main() -> () { println!(1_u32); }
}])
ect_output("1\n")
rowck_ok();
}

#[test]
wck_skipped_execution_does_not_check_output() {
program = crates![crate Foo {
fn example() -> () {}
}];

alityTest::new(program)
.expect_output("999\n")
.skip_execute()
.borrowck_ok();
}

==============================================================
alization and move tracking tests
//
 tests exercise the initialization/move analysis. Currently
lity does not track initialization or moves, so tests that
t errors are #[ignore]d. Tests that expect success pass today
ously, since there's no init checking to reject them).
==============================================================

of an uninitialized variable should be an error.
///
ust,ignore
oo() -> u32 {
let x: u32;
x  // ERROR: x isn't initialized
/// }
/// ```
#[test]
f_uninitialized_variable() {
alityTest::new(crates![crate Foo {
fn foo() -> u32 {
    let x: u32;
    return x;
}

Rules proved (48)

JudgmentRuleAll tests of this rule
borrow_checkborrow_check289 tests
borrow_check_blockbasic block289 tests
borrow_check_exprliteral205 tests
borrow_check_statementprint162 tests
check_all_cratescheck all prefixes331 tests
check_associated_tycheck associated ty312 tests
check_associated_ty_valuecheck_associated_ty_value311 tests
check_coherencecheck_coherence331 tests
check_cratecheck crate331 tests
check_crate_itemfeature gate84 tests
check_crate_itemfree fn291 tests
check_crate_itemtrait331 tests
check_crate_itemtrait impl327 tests
check_drop_impl_always_applicablenot a Drop impl327 tests
check_fncheck fn317 tests
check_fn_bodyexpr fn body289 tests
check_fn_bodyno fn body309 tests
check_fn_in_traitcheck fn in trait310 tests
check_free_fncheck free fn291 tests
check_safety_matchessafety matches327 tests
check_traitcheck trait331 tests
check_trait_implcheck_trait_impl327 tests
check_trait_impl_itemassociated ty value311 tests
check_trait_itemassociated ty in trait312 tests
check_trait_itemfn in trait310 tests
check_trait_manually_implementablenot Sized327 tests
drop_placesdrop_places289 tests
is_local_trait_reflocal trait322 tests
orphan_checkorphan_check327 tests
overlap_check_impldifferent trait311 tests
overlap_check_implnot goal312 tests
overlap_check_implsame impl327 tests
prove_afterprove_after363 tests
prove_eqexistential341 tests
prove_eqrigid318 tests
prove_eqsymmetric338 tests
prove_existential_var_eqexistential-universal332 tests
prove_outlivesoutlive through assumption312 tests
prove_predicateeq349 tests
prove_predicateoutlives321 tests
prove_predicateparameter well formed321 tests
prove_predicatepositive impl337 tests
prove_predicatetrait ref is local328 tests
prove_predicate_listnone364 tests
prove_predicate_listsome363 tests
prove_wfreferences309 tests
prove_wftuples317 tests
prove_wfuniversal variables323 tests

Premises failed (0)

This test records no negative coverage.

Proof trees

Proof tree
… (200 of 1293 nodes shown)

How to read this page