Rollup merge of #151908 - Zalathar:contains-slice, r=chenyukang

Remove unused method `DroplessArena::contains_slice`

- This method was added for https://github.com/rust-lang/rust/pull/120128.
- It became unused in https://github.com/rust-lang/rust/pull/136593.

Checking whether a particular slice is within an arena is a bit of a sketchy operation, so if there's no pressing need for it then I think we're better off not having it lying around.
This commit is contained in:
Jonathan Brouwer 2026-01-31 15:17:04 +01:00 committed by GitHub
commit 5d166b7095
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -510,19 +510,6 @@ impl DroplessArena {
}
}
/// Used by `Lift` to check whether this slice is allocated
/// in this arena.
#[inline]
pub fn contains_slice<T>(&self, slice: &[T]) -> bool {
for chunk in self.chunks.borrow_mut().iter_mut() {
let ptr = slice.as_ptr().cast::<u8>().cast_mut();
if chunk.start() <= ptr && chunk.end() >= ptr {
return true;
}
}
false
}
/// Allocates a string slice that is copied into the `DroplessArena`, returning a
/// reference to it. Will panic if passed an empty string.
///