Skip to main content

assert_no_leaks

Macro assert_no_leaks 

Source
macro_rules! assert_no_leaks {
    ($body:expr) => { ... };
    ($name:expr, |$b:ident| $block:block) => { ... };
}
Expand description

Assert that an obligation body (or inline builder) has no leaks.

§Forms

// Check an existing Body:
assert_no_leaks!(body);

// Build and check inline:
assert_no_leaks!("scope_name", |b| {
    let v = b.reserve(ObligationKind::SendPermit);
    b.commit(v);
});

§Example

use asupersync::assert_no_leaks;
use asupersync::record::ObligationKind;

// Inline form:
assert_no_leaks!("clean_handler", |b| {
    let v = b.reserve(ObligationKind::SendPermit);
    b.commit(v);
});
use asupersync::assert_no_leaks;
use asupersync::record::ObligationKind;

// This panics because the obligation is never resolved:
assert_no_leaks!("leaky_handler", |b| {
    let _v = b.reserve(ObligationKind::SendPermit);
});