Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update zerovec!/zeroslice! macro syntax to nested arrays #3611

Merged
merged 3 commits into from
Jul 3, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions components/collator/src/elements.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,11 @@ pub(crate) const FFFD_CE32: CollationElement32 = CollationElement32(FFFD_CE32_VA

pub(crate) const EMPTY_U16: &ZeroSlice<u16> = zeroslice![];
const SINGLE_REPLACEMENT_CHARACTER_U16: &ZeroSlice<u16> =
zeroslice![u16; <u16 as AsULE>::ULE::from_unsigned; REPLACEMENT_CHARACTER as u16];
zeroslice!(u16; <u16 as AsULE>::ULE::from_unsigned; [REPLACEMENT_CHARACTER as u16]);

pub(crate) const EMPTY_CHAR: &ZeroSlice<char> = zeroslice![];
const SINGLE_REPLACEMENT_CHARACTER_CHAR: &ZeroSlice<char> =
zeroslice![char; <char as AsULE>::ULE::from_aligned; REPLACEMENT_CHARACTER];
zeroslice!(char; <char as AsULE>::ULE::from_aligned; [REPLACEMENT_CHARACTER]);

/// If `opt` is `Some`, unwrap it. If `None`, panic if debug assertions
/// are enabled and return `default` if debug assertions are not enabled.
Expand Down
4 changes: 2 additions & 2 deletions components/collator/src/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ const _: () = {
};

const SINGLE_U32: &ZeroSlice<u32> =
zeroslice![u32; <u32 as AsULE>::ULE::from_unsigned; FFFD_CE32_VALUE];
zeroslice!(u32; <u32 as AsULE>::ULE::from_unsigned; [FFFD_CE32_VALUE]);
const SINGLE_U64: &ZeroSlice<u64> =
zeroslice![u64; <u64 as AsULE>::ULE::from_unsigned; FFFD_CE_VALUE];
zeroslice!(u64; <u64 as AsULE>::ULE::from_unsigned; [FFFD_CE_VALUE]);

fn data_ce_to_primary(data_ce: u64, c: char) -> u32 {
// Collation::getThreeBytePrimaryForOffsetData
Expand Down
4 changes: 2 additions & 2 deletions components/collections/src/codepointinvlist/cpinvlist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ const BMP_MAX: u32 = 0xFFFF;

/// Represents the inversion list for a set of all code points in the Basic Multilingual Plane.
const BMP_INV_LIST_VEC: ZeroVec<u32> =
zerovec![u32; <u32 as AsULE>::ULE::from_unsigned; 0x0, BMP_MAX + 1];
zerovec!(u32; <u32 as AsULE>::ULE::from_unsigned; [0x0, BMP_MAX + 1]);

/// Represents the inversion list for all of the code points in the Unicode range.
const ALL_VEC: ZeroVec<u32> =
zerovec![u32; <u32 as AsULE>::ULE::from_unsigned; 0x0, (char::MAX as u32) + 1];
zerovec!(u32; <u32 as AsULE>::ULE::from_unsigned; [0x0, (char::MAX as u32) + 1]);

/// A membership wrapper for [`CodePointInversionList`].
///
Expand Down
Loading