Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make test ptr::slice_mut compliant with Tree Borrows #68

Merged
merged 1 commit into from
Aug 26, 2024

Commits on Aug 23, 2024

  1. Make test ptr::slice_mut compliant with Tree Borrows

    Tree Borrows is a new aliasing model for Rust, which features more precise
    tracking of pointer aliasing. The aim is to be more lenient than Stacked Borrows,
    while also having less dirty hacks than SB had.
    
    It turns out that the test ptr::slice_mut here relied on one such gross hack.
    
    The problematic code is here:
    https://github.com/lumol-org/soa-derive/blob/ad918be58f47ee6d38e9c83411180e756a3220c0/tests/ptr.rs#L77-L93
    There, a slice is created, and then a reference to it is obtained using
    `slice::as_mut_ptr()`, which (internally) creates a new mutable
    reference. This means that the resulting pointer can not be mixed with
    accesses to the original slice.
    
    However, the test does so: It first uses the pointer, then the original
    slice, and then again the pointer. The proper solution is to re-derive
    the pointer when it's needed again, which is what this PR does.
    JoJoDeveloping committed Aug 23, 2024
    Configuration menu
    Copy the full SHA
    f1a5a50 View commit details
    Browse the repository at this point in the history