• anlumo@feddit.de
    link
    fedilink
    English
    arrow-up
    0
    ·
    1 year ago

    I left something important out from my explanation. Your example still holds ownership of the data, so that’s where the rules are violated with those raw pointers. You have to use Box::into_raw or something similar to disassociate the data from the Rust compiler. Then you can alias it using raw pointers.