Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information