[][src]Enum checkers::Violation

pub enum Violation {
    ConflictingAlloc {
        requested: Region,
        existing: Region,
    },
    NonZeroedAlloc {
        requested: Region,
    },
    NonCopiedRealloc {
        free: Region,
        alloc: Region,
    },
    ReallocNull {},
    MisalignedAlloc {
        requested: Region,
    },
    IncompleteFree {
        requested: Region,
        existing: Region,
    },
    MisalignedFree {
        requested: Region,
        existing: Region,
    },
    MissingFree {
        requested: Region,
    },
    Leaked {
        region: Region,
    },
}

A single violation in the variants enforced by checkers.

Variants

ConflictingAlloc

A region produced by the allocator requested, overlaps with at least on existing allocation.

Fields of ConflictingAlloc

requested: Region

The allocated region.

existing: Region

The existing region.

NonZeroedAlloc

A region produced by the allocator requested was not zeroed as expected.

Fields of NonZeroedAlloc

requested: Region

The allocated region.

NonCopiedRealloc

A region reallocatoed by the allocator was not copied appropriately. Meaning, the prefixing bytes between free and alloc do not match.

Fields of NonCopiedRealloc

free: Region

The freed region.

alloc: Region

The allocated region.

ReallocNull

Allocator was asked to reallocate a null pointer.

Fields of ReallocNull

MisalignedAlloc

A region produced by the allocator requested was not aligned appropriately.

Fields of MisalignedAlloc

requested: Region

The allocated region.

IncompleteFree

A freed region requested only freed part of at least one other region existing.

Fields of IncompleteFree

requested: Region

The freed region.

existing: Region

The existing region.

MisalignedFree

A freed region requested provided the wrong alignment metadata. See std::alloc::Layout::align.

Fields of MisalignedFree

requested: Region

The freed region.

existing: Region

The existing region.

MissingFree

A freed region requested was not allocated at the time it was freed.

Fields of MissingFree

requested: Region

The freed region.

Leaked

A region was leaked. In that it was allocated but never freed.

Fields of Leaked

region: Region

The leaked region.

Methods

impl Violation[src]

A single violation to the virtual memory model of checkers.

pub fn is_leaked_with<F>(&self, f: F) -> bool where
    F: FnOnce(Region) -> bool
[src]

Test that this violation refers to a dangling region and that it matches the given predicate.

Examples

let violation = Violation::Leaked {
    region: Region::new(42.into(), 20, 4),
};
assert!(violation.is_leaked_with(|r| r.size == 20 && r.align == 4));

let requested = Region::new(10.into(), 10, 1);
let violation = Violation::MisalignedAlloc { requested };
assert!(!violation.is_leaked_with(|r| true));

Trait Implementations

impl Clone for Violation[src]

impl Debug for Violation[src]

impl Display for Violation[src]

impl Eq for Violation[src]

impl PartialEq<Violation> for Violation[src]

impl StructuralEq for Violation[src]

impl StructuralPartialEq for Violation[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.