#[non_exhaustive]pub enum Violation {
ConflictingAlloc {
request: Request,
existing: Request,
},
NonZeroedAlloc {
alloc: Request,
},
NonCopiedRealloc {
realloc: Realloc,
},
ReallocNull {
realloc: ReallocNull,
},
MisalignedAlloc {
alloc: Request,
},
IncompleteFree {
request: Request,
existing: Request,
},
MisalignedFree {
request: Request,
existing: Request,
},
MissingFree {
request: Request,
},
Leaked {
alloc: Request,
},
}Expand description
A single violation in the variants enforced by checkers.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
ConflictingAlloc
A region produced by the allocator requested, overlaps with at least
on existing allocation.
NonZeroedAlloc
A region produced by the allocator requested was not zeroed as
expected.
NonCopiedRealloc
A region reallocatoed by the allocator was not copied appropriately.
Meaning, the prefixing bytes between free and alloc do not match.
ReallocNull
Allocator was asked to reallocate a null pointer.
Fields
realloc: ReallocNullThe null relocation.
MisalignedAlloc
A region produced by the allocator requested was not aligned
appropriately.
IncompleteFree
A freed region requested only freed part of at least one other region
existing.
MisalignedFree
A freed region requested provided the wrong alignment metadata.
See std::alloc::Layout::align.
MissingFree
A freed region requested was not allocated at the time it was freed.
Leaked
A region was leaked. In that it was allocated but never freed.
Implementations§
Source§impl Violation
A single violation to the virtual memory model of checkers.
impl Violation
A single violation to the virtual memory model of checkers.
Sourcepub fn is_leaked_with<F>(&self, f: F) -> bool
pub fn is_leaked_with<F>(&self, f: F) -> bool
Test that this violation refers to a dangling region and that it matches the given predicate.
§Examples
let alloc = Request::without_backtrace(Region::new(42.into(), 20, 4));
let violation = Violation::Leaked { alloc };
assert!(violation.is_leaked_with(|r| r.size == 20 && r.align == 4));
let alloc = Request::without_backtrace(Region::new(10.into(), 10, 1));
let violation = Violation::MisalignedAlloc { alloc };
assert!(!violation.is_leaked_with(|r| true));