fix(users/edef/weave): use safer_owning_ref

owning_ref has serious unsoundness.

Change-Id: Ie760697cd6399e6bc75f1ad17c9bb74adc077a35
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12656
Reviewed-by: edef <edef@edef.eu>
Tested-by: BuildkiteCI
Autosubmit: edef <edef@edef.eu>
Reviewed-by: flokli <flokli@flokli.de>
This commit is contained in:
edef 2024-10-17 22:37:05 +00:00 committed by clbot
parent 211cf7ba7c
commit dfff592784
4 changed files with 35 additions and 33 deletions

View file

@ -3,7 +3,7 @@ use polars::export::arrow::buffer::Buffer;
use std::ops::Deref;
/// An shared `[[u8; N]]` backed by a Polars [Buffer].
pub type FixedBytes<const N: usize> = OwningRef<Bytes, [[u8; N]]>;
pub type FixedBytes<const N: usize> = OwningRef<'static, Bytes, [[u8; N]]>;
/// Wrapper struct to make [Buffer] implement [StableAddress].
/// TODO(edef): upstream the `impl`
@ -13,7 +13,7 @@ pub struct Bytes(pub Buffer<u8>);
unsafe impl StableAddress for Bytes {}
impl Bytes {
pub fn map<U: ?Sized>(self, f: impl FnOnce(&[u8]) -> &U) -> OwningRef<Self, U> {
pub fn map<U: ?Sized>(self, f: impl FnOnce(&[u8]) -> &U) -> OwningRef<'static, Self, U> {
OwningRef::new(self).map(f)
}
}