Struct rust_examples::memory::UseAfterFreeTest[][src]

pub struct UseAfterFreeTest;
Expand description

This test shows that in safe Rust one cannot compile a code that would result in use after free.

Example

struct Data;

fn use_data(data: Data) {
    // <arbitry code using the data>
    drop(data) // Exaplicit call to `drop` the data
}

let data = Data;
// Use data once and free them afterwards
use_data(data);
// Use data again after free
use_data(data);

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.