|
let percore_ptr = unsafe { NonNull::from_ref(&self.0).byte_offset(percore_local_offset()) }; |
In this line the NonNull always points to the primary core's copy of the static, even when calling this function on a secondary core. However, the safety requirement of offset() mandates that the pointer which is the result of the offsetting should still point within the bounds of the allocation of which the original pointer was derived from. This can never be true in the current scenario, because the secondary core's copy of the static must not overlap the primary core's copy, so the offset pointer will always point to outside of the primary core's allocation.
https://doc.rust-lang.org/stable/core/ptr/struct.NonNull.html#method.offset
Note: Codex gave me the hint for this, while I was reviewing the integration of the new percore-derive feature in RF-A
percore/src/derive.rs
Line 185 in 4bd00d2
In this line the
NonNullalways points to the primary core's copy of the static, even when calling this function on a secondary core. However, the safety requirement ofoffset()mandates that the pointer which is the result of the offsetting should still point within the bounds of the allocation of which the original pointer was derived from. This can never be true in the current scenario, because the secondary core's copy of the static must not overlap the primary core's copy, so the offset pointer will always point to outside of the primary core's allocation.https://doc.rust-lang.org/stable/core/ptr/struct.NonNull.html#method.offset
Note: Codex gave me the hint for this, while I was reviewing the integration of the new percore-derive feature in RF-A