diff options
author | edef <edef@edef.eu> | 2024-10-17T22·37+0000 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2024-10-17T22·47+0000 |
commit | dfff5927842c95492f097b85e722ed7129642845 (patch) | |
tree | 8cfa75acf0ea1d9cef333d2186126c0752dd1d9d | |
parent | 211cf7ba7cb69e5728e5826333d7072c05730c97 (diff) |
fix(users/edef/weave): use safer_owning_ref r/8828
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>
-rw-r--r-- | users/edef/weave/Cargo.lock | 20 | ||||
-rw-r--r-- | users/edef/weave/Cargo.nix | 42 | ||||
-rw-r--r-- | users/edef/weave/Cargo.toml | 2 | ||||
-rw-r--r-- | users/edef/weave/src/bytes.rs | 4 |
4 files changed, 35 insertions, 33 deletions
diff --git a/users/edef/weave/Cargo.lock b/users/edef/weave/Cargo.lock index de53d26d90de..aaa77014fba2 100644 --- a/users/edef/weave/Cargo.lock +++ b/users/edef/weave/Cargo.lock @@ -1022,15 +1022,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] -name = "owning_ref" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ff55baddef9e4ad00f88b6c743a2a8062d4c6ade126c2a528644b8e444d52ce" -dependencies = [ - "stable_deref_trait", -] - -[[package]] name = "parking_lot" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1587,6 +1578,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" [[package]] +name = "safer_owning_ref" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af21b9de2df966f61c07b5b541c81c98225b86e48ababd43366a642654de30ef" +dependencies = [ + "stable_deref_trait", +] + +[[package]] name = "scopeguard" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2036,9 +2036,9 @@ dependencies = [ "anyhow", "hashbrown 0.14.5", "nix-compat", - "owning_ref", "polars", "rayon", + "safer_owning_ref", "tokio", ] diff --git a/users/edef/weave/Cargo.nix b/users/edef/weave/Cargo.nix index 2a6851c7c6d1..a06bae091c83 100644 --- a/users/edef/weave/Cargo.nix +++ b/users/edef/weave/Cargo.nix @@ -3004,22 +3004,6 @@ rec { }; resolvedDefaultFeatures = [ "alloc" "default" "race" "std" ]; }; - "owning_ref" = rec { - crateName = "owning_ref"; - version = "0.4.1"; - edition = "2015"; - sha256 = "1kjj9m28wjv452jw49p1mp3d8ql058x78v4bz00avr7rvsnmpxbg"; - authors = [ - "Marvin Löbel <loebel.marvin@gmail.com>" - ]; - dependencies = [ - { - name = "stable_deref_trait"; - packageId = "stable_deref_trait"; - } - ]; - - }; "parking_lot" = rec { crateName = "parking_lot"; version = "0.12.3"; @@ -5499,6 +5483,24 @@ rec { "no-panic" = [ "dep:no-panic" ]; }; }; + "safer_owning_ref" = rec { + crateName = "safer_owning_ref"; + version = "0.5.0"; + edition = "2015"; + sha256 = "1vrhvra2cr3a6r1vvflawj35n8lq3k443ddm0wfgcrpr5pgbj8dg"; + libName = "owning_ref"; + authors = [ + "Marvin Löbel <loebel.marvin@gmail.com>" + "Noam Ta Shma noam.tashma@gmail.com" + ]; + dependencies = [ + { + name = "stable_deref_trait"; + packageId = "stable_deref_trait"; + } + ]; + + }; "scopeguard" = rec { crateName = "scopeguard"; version = "1.2.0"; @@ -6785,10 +6787,6 @@ rec { packageId = "nix-compat"; } { - name = "owning_ref"; - packageId = "owning_ref"; - } - { name = "polars"; packageId = "polars"; features = [ "parquet" ]; @@ -6798,6 +6796,10 @@ rec { packageId = "rayon"; } { + name = "safer_owning_ref"; + packageId = "safer_owning_ref"; + } + { name = "tokio"; packageId = "tokio"; features = [ "full" ]; diff --git a/users/edef/weave/Cargo.toml b/users/edef/weave/Cargo.toml index 2058f6d36d31..69cf3cf7effd 100644 --- a/users/edef/weave/Cargo.toml +++ b/users/edef/weave/Cargo.toml @@ -11,7 +11,7 @@ members = ["."] anyhow = { version = "1.0.79", features = ["backtrace"] } hashbrown = "0.14.3" nix-compat = { version = "0.1.0", path = "../../../tvix/nix-compat" } -owning_ref = "0.4.1" +safer_owning_ref = "0.5.0" rayon = "1.8.1" tokio = { version = "1.36.0", features = ["full"] } diff --git a/users/edef/weave/src/bytes.rs b/users/edef/weave/src/bytes.rs index c6dc2ebb4492..689b8fdfc0c8 100644 --- a/users/edef/weave/src/bytes.rs +++ b/users/edef/weave/src/bytes.rs @@ -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) } } |