Conversation
…ll_slice_len` > [..] because [..] there might be outstanding mutable references to the > slice. <https://doc.rust-lang.org/reference/behavior-considered-undefined.html> > The exact aliasing rules are not determined yet, but here is an > outline of the general principles: `&T` must point to memory that is > not mutated while they are live (except for data inside an > `UnsafeCell<U>`),
0794900 to
de7a0c8
Compare
zjp-CN
reviewed
Nov 22, 2025
4d7183d to
856f619
Compare
Because of how this polyfill is implemented, it can only be used on a dereferencable pointer. It does not need to be initialized (owing to `UnsafeCell`) or immuable (owing to `MaybeUninit`).
`&mut self.pool[$expr]` would invalidate the previously returned slice pointer.
…s_block` `&BlockHdr` lacks permission to access the next `BlockHdr`, which `BlockHdr::next_phys_block` returns.
A borrowed `*BlockHdr` lacks permission to access the adjacent blocks.
Get a raw pointer to a specific field and read or write to it instead of
borrowing a whole `{Free,Used}BlockHdr` unless it is known to be fully
initialized.
…ange `ShadowAllocator::remove_pool` needs a dereferencable slice pointer to get its length because `<*const [T]>::len` is not stable yet in the MSRV.
…cator::remove_pool`
A pointer created from `pool.0[0]` only has permission for `pool.0[0]`, not whole `pool.0`.
856f619 to
9be6e88
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Makes the code compliant with the current aliasing model. Fixes #9.
Remaining Issues
Test failure incargo +nightly miri test -p rlsf --test global nonexistentGlobalAlloc::{de,re}allocwhen running on Miri #18Limitations