mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +00:00
xous: don't allow mutable slices from immutable ranges
If a MemoryRange is defined as immutable, don't allow `as_mut_slice()` to be called. This is an API-breaking change. Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
parent
66005b8b6f
commit
5fcfd6a2aa
1 changed files with 1 additions and 1 deletions
|
|
@ -703,7 +703,7 @@ impl MemoryRange {
|
|||
/// For example, if the allocation is 4096 bytes, then the resulting
|
||||
/// `&[u8]` would have 4096 elements, `&[u16]` would have 2048, and
|
||||
/// `&[u32]` would have 1024. Values are rounded down.
|
||||
pub fn as_slice_mut<T>(&self) -> &mut [T] {
|
||||
pub fn as_slice_mut<T>(&mut self) -> &mut [T] {
|
||||
// This is safe because the pointer and length are guaranteed to
|
||||
// be valid, as long as the user hasn't already called `as_ptr()`
|
||||
// and done something unsound with the resulting pointer.
|
||||
|
|
|
|||
Loading…
Reference in a new issue