Bug 1910494 - Upgrade zerovec to 0.10.4. r=supply-chain-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D218020
This commit is contained in:
Mike Hommey 2024-07-29 22:36:02 +00:00
parent 850e1046eb
commit 70e59cb8e4
11 changed files with 30 additions and 25 deletions

4
Cargo.lock generated
View File

@ -7175,9 +7175,9 @@ dependencies = [
[[package]] [[package]]
name = "zerovec" name = "zerovec"
version = "0.10.2" version = "0.10.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb2cc8827d6c0994478a15c53f374f46fbd41bea663d809b14744bc42e6b109c" checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079"
dependencies = [ dependencies = [
"yoke", "yoke",
"zerofrom", "zerofrom",

View File

@ -5324,6 +5324,11 @@ who = "Makoto Kato <m_kato@ga2.so-net.ne.jp>"
criteria = "safe-to-deploy" criteria = "safe-to-deploy"
delta = "0.10.1 -> 0.10.2" delta = "0.10.1 -> 0.10.2"
[[audits.zerovec]]
who = "Mike Hommey <mh+mozilla@glandium.org>"
criteria = "safe-to-deploy"
delta = "0.10.2 -> 0.10.4"
[[audits.zerovec-derive]] [[audits.zerovec-derive]]
who = "Makoto Kato <m_kato@ga2.so-net.ne.jp>" who = "Makoto Kato <m_kato@ga2.so-net.ne.jp>"
criteria = "safe-to-deploy" criteria = "safe-to-deploy"

File diff suppressed because one or more lines are too long

View File

@ -633,7 +633,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"rand",
"static_assertions", "static_assertions",
] ]
@ -905,7 +904,7 @@ checksum = "91ec111ce797d0e0784a1116d0ddcdbea84322cd79e5d5ad173daeba4f93ab55"
[[package]] [[package]]
name = "zerovec" name = "zerovec"
version = "0.10.2" version = "0.10.4"
dependencies = [ dependencies = [
"bincode", "bincode",
"criterion", "criterion",
@ -927,9 +926,9 @@ dependencies = [
[[package]] [[package]]
name = "zerovec-derive" name = "zerovec-derive"
version = "0.10.2" version = "0.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97cf56601ee5052b4417d90c8755c6683473c926039908196cf35d99f893ebe7" checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",

View File

@ -13,7 +13,7 @@
edition = "2021" edition = "2021"
rust-version = "1.67" rust-version = "1.67"
name = "zerovec" name = "zerovec"
version = "0.10.2" version = "0.10.4"
authors = ["The ICU4X Project Developers"] authors = ["The ICU4X Project Developers"]
include = [ include = [
"data/**/*", "data/**/*",
@ -101,6 +101,7 @@ default-features = false
[dependencies.twox-hash] [dependencies.twox-hash]
version = "1.4.2" version = "1.4.2"
optional = true optional = true
default-features = false
[dependencies.yoke] [dependencies.yoke]
version = ">=0.6.0, <0.8.0" version = ">=0.6.0, <0.8.0"

View File

@ -13,7 +13,7 @@ use core::ops::Range;
const USIZE_WIDTH: usize = mem::size_of::<usize>(); const USIZE_WIDTH: usize = mem::size_of::<usize>();
/// A zero-copy "slice" that efficiently represents `[usize]`. /// A zero-copy "slice" that efficiently represents `[usize]`.
#[repr(packed)] #[repr(C, packed)]
pub struct FlexZeroSlice { pub struct FlexZeroSlice {
// Hard Invariant: 1 <= width <= USIZE_WIDTH (which is target_pointer_width) // Hard Invariant: 1 <= width <= USIZE_WIDTH (which is target_pointer_width)
// Soft Invariant: width == the width of the largest element // Soft Invariant: width == the width of the largest element

View File

@ -47,9 +47,9 @@
//! # field3: ZeroVec<'a, u32> //! # field3: ZeroVec<'a, u32>
//! # } //! # }
//! //!
//! // Must be repr(packed) for safety of VarULE! //! // Must be repr(C, packed) for safety of VarULE!
//! // Must also only contain ULE types //! // Must also only contain ULE types
//! #[repr(packed)] //! #[repr(C, packed)]
//! struct FooULE { //! struct FooULE {
//! field1: <char as AsULE>::ULE, //! field1: <char as AsULE>::ULE,
//! field2: <u32 as AsULE>::ULE, //! field2: <u32 as AsULE>::ULE,
@ -57,9 +57,9 @@
//! } //! }
//! //!
//! // Safety (based on the safety checklist on the VarULE trait): //! // Safety (based on the safety checklist on the VarULE trait):
//! // 1. FooULE does not include any uninitialized or padding bytes. (achieved by `#[repr(packed)]` on //! // 1. FooULE does not include any uninitialized or padding bytes. (achieved by `#[repr(C, packed)]` on
//! // a struct with only ULE fields) //! // a struct with only ULE fields)
//! // 2. FooULE is aligned to 1 byte. (achieved by `#[repr(packed)]` on //! // 2. FooULE is aligned to 1 byte. (achieved by `#[repr(C, packed)]` on
//! // a struct with only ULE fields) //! // a struct with only ULE fields)
//! // 3. The impl of `validate_byte_slice()` returns an error if any byte is not valid. //! // 3. The impl of `validate_byte_slice()` returns an error if any byte is not valid.
//! // 4. The impl of `validate_byte_slice()` returns an error if the slice cannot be used in its entirety //! // 4. The impl of `validate_byte_slice()` returns an error if the slice cannot be used in its entirety

View File

@ -61,7 +61,7 @@ use core::{mem, slice};
/// 6. Acknowledge the following note about the equality invariant. /// 6. Acknowledge the following note about the equality invariant.
/// ///
/// If the ULE type is a struct only containing other ULE types (or other types which satisfy invariants 1 and 2, /// If the ULE type is a struct only containing other ULE types (or other types which satisfy invariants 1 and 2,
/// like `[u8; N]`), invariants 1 and 2 can be achieved via `#[repr(packed)]` or `#[repr(transparent)]`. /// like `[u8; N]`), invariants 1 and 2 can be achieved via `#[repr(C, packed)]` or `#[repr(transparent)]`.
/// ///
/// # Equality invariant /// # Equality invariant
/// ///
@ -271,7 +271,7 @@ where
/// 7. Acknowledge the following note about the equality invariant. /// 7. Acknowledge the following note about the equality invariant.
/// ///
/// If the ULE type is a struct only containing other ULE/VarULE types (or other types which satisfy invariants 1 and 2, /// If the ULE type is a struct only containing other ULE/VarULE types (or other types which satisfy invariants 1 and 2,
/// like `[u8; N]`), invariants 1 and 2 can be achieved via `#[repr(packed)]` or `#[repr(transparent)]`. /// like `[u8; N]`), invariants 1 and 2 can be achieved via `#[repr(C, packed)]` or `#[repr(transparent)]`.
/// ///
/// # Equality invariant /// # Equality invariant
/// ///

View File

@ -108,7 +108,7 @@ impl<U: NicheBytes<N> + ULE + Eq, const N: usize> Eq for NichedOptionULE<U, N> {
/// containing only ULE fields. /// containing only ULE fields.
/// NichedOptionULE either contains NICHE_BIT_PATTERN or valid U byte sequences. /// NichedOptionULE either contains NICHE_BIT_PATTERN or valid U byte sequences.
/// In both cases the data is initialized. /// In both cases the data is initialized.
/// 2. NichedOptionULE is aligned to 1 byte due to `#[repr(packed)]` on a struct containing only /// 2. NichedOptionULE is aligned to 1 byte due to `#[repr(C, packed)]` on a struct containing only
/// ULE fields. /// ULE fields.
/// 3. validate_byte_slice impl returns an error if invalid bytes are encountered. /// 3. validate_byte_slice impl returns an error if invalid bytes are encountered.
/// 4. validate_byte_slice impl returns an error there are extra bytes. /// 4. validate_byte_slice impl returns an error there are extra bytes.

View File

@ -28,7 +28,7 @@ use core::mem::{self, MaybeUninit};
// Invariants: // Invariants:
// The MaybeUninit is zeroed when None (bool = false), // The MaybeUninit is zeroed when None (bool = false),
// and is valid when Some (bool = true) // and is valid when Some (bool = true)
#[repr(packed)] #[repr(C, packed)]
pub struct OptionULE<U>(bool, MaybeUninit<U>); pub struct OptionULE<U>(bool, MaybeUninit<U>);
impl<U: Copy> OptionULE<U> { impl<U: Copy> OptionULE<U> {
@ -62,11 +62,11 @@ impl<U: Copy + core::fmt::Debug> core::fmt::Debug for OptionULE<U> {
// Safety (based on the safety checklist on the ULE trait): // Safety (based on the safety checklist on the ULE trait):
// 1. OptionULE does not include any uninitialized or padding bytes. // 1. OptionULE does not include any uninitialized or padding bytes.
// (achieved by `#[repr(packed)]` on a struct containing only ULE fields, // (achieved by `#[repr(C, packed)]` on a struct containing only ULE fields,
// in the context of this impl. The MaybeUninit is valid for all byte sequences, and we only generate // in the context of this impl. The MaybeUninit is valid for all byte sequences, and we only generate
/// zeroed or valid-T byte sequences to fill it) /// zeroed or valid-T byte sequences to fill it)
// 2. OptionULE is aligned to 1 byte. // 2. OptionULE is aligned to 1 byte.
// (achieved by `#[repr(packed)]` on a struct containing only ULE fields, in the context of this impl) // (achieved by `#[repr(C, packed)]` on a struct containing only ULE fields, in the context of this impl)
// 3. The impl of validate_byte_slice() returns an error if any byte is not valid. // 3. The impl of validate_byte_slice() returns an error if any byte is not valid.
// 4. The impl of validate_byte_slice() returns an error if there are extra bytes. // 4. The impl of validate_byte_slice() returns an error if there are extra bytes.
// 5. The other ULE methods use the default impl. // 5. The other ULE methods use the default impl.
@ -141,7 +141,7 @@ impl<U: Copy + Eq> Eq for OptionULE<U> {}
/// ``` /// ```
// The slice field is empty when None (bool = false), // The slice field is empty when None (bool = false),
// and is a valid T when Some (bool = true) // and is a valid T when Some (bool = true)
#[repr(packed)] #[repr(C, packed)]
pub struct OptionVarULE<U: VarULE + ?Sized>(PhantomData<U>, bool, [u8]); pub struct OptionVarULE<U: VarULE + ?Sized>(PhantomData<U>, bool, [u8]);
impl<U: VarULE + ?Sized> OptionVarULE<U> { impl<U: VarULE + ?Sized> OptionVarULE<U> {
@ -166,8 +166,8 @@ impl<U: VarULE + ?Sized + core::fmt::Debug> core::fmt::Debug for OptionVarULE<U>
// Safety (based on the safety checklist on the VarULE trait): // Safety (based on the safety checklist on the VarULE trait):
// 1. OptionVarULE<T> does not include any uninitialized or padding bytes // 1. OptionVarULE<T> does not include any uninitialized or padding bytes
// (achieved by being repr(packed) on ULE types) // (achieved by being repr(C, packed) on ULE types)
// 2. OptionVarULE<T> is aligned to 1 byte (achieved by being repr(packed) on ULE types) // 2. OptionVarULE<T> is aligned to 1 byte (achieved by being repr(C, packed) on ULE types)
// 3. The impl of `validate_byte_slice()` returns an error if any byte is not valid. // 3. The impl of `validate_byte_slice()` returns an error if any byte is not valid.
// 4. The impl of `validate_byte_slice()` returns an error if the slice cannot be used in its entirety // 4. The impl of `validate_byte_slice()` returns an error if the slice cannot be used in its entirety
// 5. The impl of `from_byte_slice_unchecked()` returns a reference to the same data. // 5. The impl of `from_byte_slice_unchecked()` returns a reference to the same data.

View File

@ -30,15 +30,15 @@ use core::mem;
macro_rules! tuple_ule { macro_rules! tuple_ule {
($name:ident, $len:literal, [ $($t:ident $i:tt),+ ]) => { ($name:ident, $len:literal, [ $($t:ident $i:tt),+ ]) => {
#[doc = concat!("ULE type for tuples with ", $len, " elements.")] #[doc = concat!("ULE type for tuples with ", $len, " elements.")]
#[repr(packed)] #[repr(C, packed)]
#[allow(clippy::exhaustive_structs)] // stable #[allow(clippy::exhaustive_structs)] // stable
pub struct $name<$($t),+>($(pub $t),+); pub struct $name<$($t),+>($(pub $t),+);
// Safety (based on the safety checklist on the ULE trait): // Safety (based on the safety checklist on the ULE trait):
// 1. TupleULE does not include any uninitialized or padding bytes. // 1. TupleULE does not include any uninitialized or padding bytes.
// (achieved by `#[repr(packed)]` on a struct containing only ULE fields) // (achieved by `#[repr(C, packed)]` on a struct containing only ULE fields)
// 2. TupleULE is aligned to 1 byte. // 2. TupleULE is aligned to 1 byte.
// (achieved by `#[repr(packed)]` on a struct containing only ULE fields) // (achieved by `#[repr(C, packed)]` on a struct containing only ULE fields)
// 3. The impl of validate_byte_slice() returns an error if any byte is not valid. // 3. The impl of validate_byte_slice() returns an error if any byte is not valid.
// 4. The impl of validate_byte_slice() returns an error if there are extra bytes. // 4. The impl of validate_byte_slice() returns an error if there are extra bytes.
// 5. The other ULE methods use the default impl. // 5. The other ULE methods use the default impl.