summaryrefslogtreecommitdiffstats
path: root/vendor/icu_locid/src
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
commit9835e2ae736235810b4ea1c162ca5e65c547e770 (patch)
tree3fcebf40ed70e581d776a8a4c65923e8ec20e026 /vendor/icu_locid/src
parentReleasing progress-linux version 1.70.0+dfsg2-1~progress7.99u1. (diff)
downloadrustc-9835e2ae736235810b4ea1c162ca5e65c547e770.tar.xz
rustc-9835e2ae736235810b4ea1c162ca5e65c547e770.zip
Merging upstream version 1.71.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/icu_locid/src')
-rw-r--r--vendor/icu_locid/src/databake.rs23
-rw-r--r--vendor/icu_locid/src/extensions/mod.rs2
-rw-r--r--vendor/icu_locid/src/extensions/unicode/keywords.rs14
-rw-r--r--vendor/icu_locid/src/extensions/unicode/value.rs12
-rw-r--r--vendor/icu_locid/src/helpers.rs131
-rw-r--r--vendor/icu_locid/src/langid.rs2
-rw-r--r--vendor/icu_locid/src/lib.rs8
-rw-r--r--vendor/icu_locid/src/locale.rs27
-rw-r--r--vendor/icu_locid/src/ordering.rs1
-rw-r--r--vendor/icu_locid/src/parser/errors.rs2
-rw-r--r--vendor/icu_locid/src/subtags/variants.rs10
11 files changed, 130 insertions, 102 deletions
diff --git a/vendor/icu_locid/src/databake.rs b/vendor/icu_locid/src/databake.rs
new file mode 100644
index 000000000..03b7357c5
--- /dev/null
+++ b/vendor/icu_locid/src/databake.rs
@@ -0,0 +1,23 @@
+// This file is part of ICU4X. For terms of use, please see the file
+// called LICENSE at the top level of the ICU4X source tree
+// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ).
+
+use crate::LanguageIdentifier;
+use alloc::string::ToString;
+use databake::*;
+
+impl Bake for LanguageIdentifier {
+ fn bake(&self, env: &CrateEnv) -> TokenStream {
+ env.insert("icu_locid");
+ let repr = self.to_string();
+ if self.variants.len() <= 1 {
+ quote! {
+ icu_locid::langid!(#repr)
+ }
+ } else {
+ quote! {
+ icu_locid::LanguageIdentifier::from_str(#repr).unwrap()
+ }
+ }
+ }
+}
diff --git a/vendor/icu_locid/src/extensions/mod.rs b/vendor/icu_locid/src/extensions/mod.rs
index a6a189b11..5f1ad2b1f 100644
--- a/vendor/icu_locid/src/extensions/mod.rs
+++ b/vendor/icu_locid/src/extensions/mod.rs
@@ -214,7 +214,7 @@ impl Extensions {
if subtag.is_empty() {
return Err(ParserError::InvalidExtension);
}
- match subtag.get(0).map(|b| ExtensionType::try_from_byte(*b)) {
+ match subtag.first().map(|b| ExtensionType::try_from_byte(*b)) {
Some(Ok(ExtensionType::Unicode)) => {
if unicode.is_some() {
return Err(ParserError::DuplicatedExtension);
diff --git a/vendor/icu_locid/src/extensions/unicode/keywords.rs b/vendor/icu_locid/src/extensions/unicode/keywords.rs
index 580cacaf1..4e2fbae9a 100644
--- a/vendor/icu_locid/src/extensions/unicode/keywords.rs
+++ b/vendor/icu_locid/src/extensions/unicode/keywords.rs
@@ -9,7 +9,7 @@ use litemap::LiteMap;
use super::Key;
use super::Value;
-use crate::helpers::ShortVec;
+use crate::helpers::ShortSlice;
use crate::ordering::SubtagOrderingResult;
/// A list of [`Key`]-[`Value`] pairs representing functional information
@@ -66,7 +66,7 @@ use crate::ordering::SubtagOrderingResult;
///
/// [`Locale`]: crate::Locale
#[derive(Clone, PartialEq, Eq, Debug, Default, Hash, PartialOrd, Ord)]
-pub struct Keywords(LiteMap<Key, Value, ShortVec<(Key, Value)>>);
+pub struct Keywords(LiteMap<Key, Value, ShortSlice<(Key, Value)>>);
impl Keywords {
/// Returns a new empty list of key-value pairs. Same as [`default()`](Default::default()), but is `const`.
@@ -86,9 +86,9 @@ impl Keywords {
/// Create a new list of key-value pairs having exactly one pair, callable in a `const` context.
#[inline]
pub const fn new_single(key: Key, value: Value) -> Self {
- Self(LiteMap::from_sorted_store_unchecked(ShortVec::new_single(
- (key, value),
- )))
+ Self(LiteMap::from_sorted_store_unchecked(
+ ShortSlice::new_single((key, value)),
+ ))
}
/// Returns `true` if there are no keywords.
@@ -390,8 +390,8 @@ impl Keywords {
}
}
-impl From<LiteMap<Key, Value, ShortVec<(Key, Value)>>> for Keywords {
- fn from(map: LiteMap<Key, Value, ShortVec<(Key, Value)>>) -> Self {
+impl From<LiteMap<Key, Value, ShortSlice<(Key, Value)>>> for Keywords {
+ fn from(map: LiteMap<Key, Value, ShortSlice<(Key, Value)>>) -> Self {
Self(map)
}
}
diff --git a/vendor/icu_locid/src/extensions/unicode/value.rs b/vendor/icu_locid/src/extensions/unicode/value.rs
index e6374372c..f1b2402de 100644
--- a/vendor/icu_locid/src/extensions/unicode/value.rs
+++ b/vendor/icu_locid/src/extensions/unicode/value.rs
@@ -2,7 +2,7 @@
// called LICENSE at the top level of the ICU4X source tree
// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ).
-use crate::helpers::ShortVec;
+use crate::helpers::ShortSlice;
use crate::parser::{ParserError, SubtagIterator};
use alloc::vec::Vec;
use core::ops::RangeInclusive;
@@ -35,7 +35,7 @@ use tinystr::TinyAsciiStr;
/// assert_eq!(value!("true").to_string(), "");
/// ```
#[derive(Debug, PartialEq, Eq, Clone, Hash, PartialOrd, Ord, Default)]
-pub struct Value(ShortVec<TinyAsciiStr<{ *VALUE_LENGTH.end() }>>);
+pub struct Value(ShortSlice<TinyAsciiStr<{ *VALUE_LENGTH.end() }>>);
const VALUE_LENGTH: RangeInclusive<usize> = 3..=8;
const TRUE_VALUE: TinyAsciiStr<8> = tinystr::tinystr!(8, "true");
@@ -52,7 +52,7 @@ impl Value {
/// Value::try_from_bytes(b"buddhist").expect("Parsing failed.");
/// ```
pub fn try_from_bytes(input: &[u8]) -> Result<Self, ParserError> {
- let mut v = ShortVec::new();
+ let mut v = Vec::new();
if !input.is_empty() {
for subtag in SubtagIterator::new(input) {
@@ -62,7 +62,7 @@ impl Value {
}
}
}
- Ok(Self(v))
+ Ok(Self(v.into()))
}
/// Const constructor for when the value contains only a single subtag.
@@ -96,11 +96,11 @@ impl Value {
#[doc(hidden)]
pub const fn from_tinystr(subtag: Option<TinyAsciiStr<8>>) -> Self {
match subtag {
- None => Self(ShortVec::new()),
+ None => Self(ShortSlice::new()),
Some(val) => {
debug_assert!(val.is_ascii_alphanumeric());
debug_assert!(!matches!(val, TRUE_VALUE));
- Self(ShortVec::new_single(val))
+ Self(ShortSlice::new_single(val))
}
}
}
diff --git a/vendor/icu_locid/src/helpers.rs b/vendor/icu_locid/src/helpers.rs
index e5889a7b0..42b2b7286 100644
--- a/vendor/icu_locid/src/helpers.rs
+++ b/vendor/icu_locid/src/helpers.rs
@@ -4,36 +4,40 @@
use core::iter::FromIterator;
+use alloc::boxed::Box;
use alloc::vec;
use alloc::vec::Vec;
use litemap::store::*;
/// Internal: A vector that supports no-allocation, constant values if length 0 or 1.
+/// Using ZeroOne(Option<T>) saves 8 bytes in ShortSlice via niche optimization.
#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
-pub(crate) enum ShortVec<T> {
- Empty,
- Single(T),
- Multi(Vec<T>),
+pub(crate) enum ShortSlice<T> {
+ ZeroOne(Option<T>),
+ Multi(Box<[T]>),
}
-impl<T> ShortVec<T> {
+impl<T> ShortSlice<T> {
#[inline]
pub const fn new() -> Self {
- Self::Empty
+ Self::ZeroOne(None)
}
#[inline]
pub const fn new_single(item: T) -> Self {
- Self::Single(item)
+ Self::ZeroOne(Some(item))
}
pub fn push(&mut self, item: T) {
- *self = match core::mem::replace(self, Self::Empty) {
- ShortVec::Empty => ShortVec::Single(item),
- ShortVec::Single(prev_item) => ShortVec::Multi(vec![prev_item, item]),
- ShortVec::Multi(mut items) => {
+ *self = match core::mem::replace(self, Self::ZeroOne(None)) {
+ ShortSlice::ZeroOne(None) => ShortSlice::ZeroOne(Some(item)),
+ ShortSlice::ZeroOne(Some(prev_item)) => {
+ ShortSlice::Multi(vec![prev_item, item].into_boxed_slice())
+ }
+ ShortSlice::Multi(items) => {
+ let mut items = items.into_vec();
items.push(item);
- ShortVec::Multi(items)
+ ShortSlice::Multi(items.into_boxed_slice())
}
};
}
@@ -41,25 +45,25 @@ impl<T> ShortVec<T> {
#[inline]
pub fn as_slice(&self) -> &[T] {
match self {
- ShortVec::Empty => &[],
- ShortVec::Single(v) => core::slice::from_ref(v),
- ShortVec::Multi(v) => v.as_slice(),
+ ShortSlice::ZeroOne(None) => &[],
+ ShortSlice::ZeroOne(Some(v)) => core::slice::from_ref(v),
+ ShortSlice::Multi(v) => v,
}
}
#[inline]
pub fn as_mut_slice(&mut self) -> &mut [T] {
match self {
- ShortVec::Empty => &mut [],
- ShortVec::Single(v) => core::slice::from_mut(v),
- ShortVec::Multi(v) => v.as_mut_slice(),
+ ShortSlice::ZeroOne(None) => &mut [],
+ ShortSlice::ZeroOne(Some(v)) => core::slice::from_mut(v),
+ ShortSlice::Multi(v) => v,
}
}
#[inline]
pub const fn single(&self) -> Option<&T> {
match self {
- ShortVec::Single(v) => Some(v),
+ ShortSlice::ZeroOne(Some(v)) => Some(v),
_ => None,
}
}
@@ -67,9 +71,9 @@ impl<T> ShortVec<T> {
#[inline]
pub fn len(&self) -> usize {
match self {
- ShortVec::Empty => 0,
- ShortVec::Single(_) => 1,
- ShortVec::Multi(ref v) => v.len(),
+ ShortSlice::ZeroOne(None) => 0,
+ ShortSlice::ZeroOne(_) => 1,
+ ShortSlice::Multi(ref v) => v.len(),
}
}
@@ -81,19 +85,20 @@ impl<T> ShortVec<T> {
self.len()
);
- *self = match core::mem::replace(self, ShortVec::Empty) {
- ShortVec::Empty => ShortVec::Single(elt),
- ShortVec::Single(item) => {
+ *self = match core::mem::replace(self, ShortSlice::ZeroOne(None)) {
+ ShortSlice::ZeroOne(None) => ShortSlice::ZeroOne(Some(elt)),
+ ShortSlice::ZeroOne(Some(item)) => {
let items = if index == 0 {
- vec![elt, item]
+ vec![elt, item].into_boxed_slice()
} else {
- vec![item, elt]
+ vec![item, elt].into_boxed_slice()
};
- ShortVec::Multi(items)
+ ShortSlice::Multi(items)
}
- ShortVec::Multi(mut items) => {
+ ShortSlice::Multi(items) => {
+ let mut items = items.into_vec();
items.insert(index, elt);
- ShortVec::Multi(items)
+ ShortSlice::Multi(items.into_boxed_slice())
}
}
}
@@ -106,17 +111,18 @@ impl<T> ShortVec<T> {
self.len()
);
- let (replaced, removed_item) = match core::mem::replace(self, ShortVec::Empty) {
- ShortVec::Empty => unreachable!(),
- ShortVec::Single(v) => (ShortVec::Empty, v),
- ShortVec::Multi(mut v) => {
+ let (replaced, removed_item) = match core::mem::replace(self, ShortSlice::ZeroOne(None)) {
+ ShortSlice::ZeroOne(None) => unreachable!(),
+ ShortSlice::ZeroOne(Some(v)) => (ShortSlice::ZeroOne(None), v),
+ ShortSlice::Multi(v) => {
+ let mut v = v.into_vec();
let removed_item = v.remove(index);
match v.len() {
#[allow(clippy::unwrap_used)]
// we know that the vec has exactly one element left
- 1 => (ShortVec::Single(v.pop().unwrap()), removed_item),
+ 1 => (ShortSlice::ZeroOne(Some(v.pop().unwrap())), removed_item),
// v has at least 2 elements, create a Multi variant
- _ => (ShortVec::Multi(v), removed_item),
+ _ => (ShortSlice::Multi(v.into_boxed_slice()), removed_item),
}
}
};
@@ -126,38 +132,38 @@ impl<T> ShortVec<T> {
#[inline]
pub fn clear(&mut self) {
- let _ = core::mem::replace(self, ShortVec::Empty);
+ let _ = core::mem::replace(self, ShortSlice::ZeroOne(None));
}
}
-impl<T> From<Vec<T>> for ShortVec<T> {
+impl<T> From<Vec<T>> for ShortSlice<T> {
fn from(v: Vec<T>) -> Self {
match v.len() {
- 0 => ShortVec::Empty,
+ 0 => ShortSlice::ZeroOne(None),
#[allow(clippy::unwrap_used)] // we know that the vec is not empty
- 1 => ShortVec::Single(v.into_iter().next().unwrap()),
- _ => ShortVec::Multi(v),
+ 1 => ShortSlice::ZeroOne(Some(v.into_iter().next().unwrap())),
+ _ => ShortSlice::Multi(v.into_boxed_slice()),
}
}
}
-impl<T> Default for ShortVec<T> {
+impl<T> Default for ShortSlice<T> {
fn default() -> Self {
- ShortVec::Empty
+ ShortSlice::ZeroOne(None)
}
}
-impl<T> FromIterator<T> for ShortVec<T> {
+impl<T> FromIterator<T> for ShortSlice<T> {
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self {
iter.into_iter().collect::<Vec<_>>().into()
}
}
-impl<K, V> StoreConstEmpty<K, V> for ShortVec<(K, V)> {
- const EMPTY: ShortVec<(K, V)> = ShortVec::Empty;
+impl<K, V> StoreConstEmpty<K, V> for ShortSlice<(K, V)> {
+ const EMPTY: ShortSlice<(K, V)> = ShortSlice::ZeroOne(None);
}
-impl<K, V> Store<K, V> for ShortVec<(K, V)> {
+impl<K, V> Store<K, V> for ShortSlice<(K, V)> {
#[inline]
fn lm_len(&self) -> usize {
self.len()
@@ -165,7 +171,7 @@ impl<K, V> Store<K, V> for ShortVec<(K, V)> {
#[inline]
fn lm_is_empty(&self) -> bool {
- matches!(self, ShortVec::Empty)
+ matches!(self, ShortSlice::ZeroOne(None))
}
#[inline]
@@ -176,9 +182,8 @@ impl<K, V> Store<K, V> for ShortVec<(K, V)> {
#[inline]
fn lm_last(&self) -> Option<(&K, &V)> {
match self {
- ShortVec::Empty => None,
- ShortVec::Single(v) => Some(v),
- ShortVec::Multi(v) => v.as_slice().last(),
+ ShortSlice::ZeroOne(v) => v.as_ref(),
+ ShortSlice::Multi(v) => v.last(),
}
.map(|elt| (&elt.0, &elt.1))
}
@@ -192,18 +197,20 @@ impl<K, V> Store<K, V> for ShortVec<(K, V)> {
}
}
-impl<K, V> StoreMut<K, V> for ShortVec<(K, V)> {
- fn lm_with_capacity(_capacity: usize) -> Self {
- ShortVec::Empty
+impl<K: Ord, V> StoreFromIterable<K, V> for ShortSlice<(K, V)> {
+ fn lm_sort_from_iter<I: IntoIterator<Item = (K, V)>>(iter: I) -> Self {
+ let v: Vec<(K, V)> = Vec::lm_sort_from_iter(iter);
+ v.into()
}
+}
- // ShortVec supports reserving capacity for additional elements only if we have already allocated a vector
- fn lm_reserve(&mut self, additional: usize) {
- if let ShortVec::Multi(ref mut v) = self {
- v.reserve(additional)
- }
+impl<K, V> StoreMut<K, V> for ShortSlice<(K, V)> {
+ fn lm_with_capacity(_capacity: usize) -> Self {
+ ShortSlice::ZeroOne(None)
}
+ fn lm_reserve(&mut self, _additional: usize) {}
+
fn lm_get_mut(&mut self, index: usize) -> Option<(&K, &mut V)> {
self.as_mut_slice()
.get_mut(index)
@@ -227,7 +234,7 @@ impl<K, V> StoreMut<K, V> for ShortVec<(K, V)> {
}
}
-impl<'a, K: 'a, V: 'a> StoreIterable<'a, K, V> for ShortVec<(K, V)> {
+impl<'a, K: 'a, V: 'a> StoreIterable<'a, K, V> for ShortSlice<(K, V)> {
type KeyValueIter =
core::iter::Map<core::slice::Iter<'a, (K, V)>, for<'r> fn(&'r (K, V)) -> (&'r K, &'r V)>;
@@ -236,11 +243,11 @@ impl<'a, K: 'a, V: 'a> StoreIterable<'a, K, V> for ShortVec<(K, V)> {
}
}
-impl<K, V> StoreFromIterator<K, V> for ShortVec<(K, V)> {}
+impl<K, V> StoreFromIterator<K, V> for ShortSlice<(K, V)> {}
#[test]
fn test_shortvec_impl() {
- litemap::testing::check_store::<ShortVec<(u32, u64)>>();
+ litemap::testing::check_store::<ShortSlice<(u32, u64)>>();
}
macro_rules! impl_tinystr_subtag {
diff --git a/vendor/icu_locid/src/langid.rs b/vendor/icu_locid/src/langid.rs
index b6858c91b..78668bc0d 100644
--- a/vendor/icu_locid/src/langid.rs
+++ b/vendor/icu_locid/src/langid.rs
@@ -307,7 +307,7 @@ impl LanguageIdentifier {
return false;
}
}
- iter.next() == None
+ iter.next().is_none()
}
pub(crate) fn for_each_subtag_str<E, F>(&self, f: &mut F) -> Result<(), E>
diff --git a/vendor/icu_locid/src/lib.rs b/vendor/icu_locid/src/lib.rs
index 226a8e53c..d9c4f7699 100644
--- a/vendor/icu_locid/src/lib.rs
+++ b/vendor/icu_locid/src/lib.rs
@@ -56,7 +56,7 @@
clippy::panic,
clippy::exhaustive_structs,
clippy::exhaustive_enums,
- // TODO(#2266): enable missing_debug_implementations,
+ missing_debug_implementations,
)
)]
#![warn(missing_docs)]
@@ -77,9 +77,15 @@ pub use locale::Locale;
pub use ordering::SubtagOrderingResult;
pub use parser::errors::ParserError;
+#[doc(no_inline)]
+pub use ParserError as Error;
+
pub mod extensions;
pub mod subtags;
pub mod zerovec;
#[cfg(feature = "serde")]
mod serde;
+
+#[cfg(feature = "databake")]
+mod databake;
diff --git a/vendor/icu_locid/src/locale.rs b/vendor/icu_locid/src/locale.rs
index 5d9109fee..4412da86e 100644
--- a/vendor/icu_locid/src/locale.rs
+++ b/vendor/icu_locid/src/locale.rs
@@ -87,35 +87,24 @@ pub struct Locale {
#[test]
fn test_sizes() {
- // Remove when we upgrade to a compiler where the new sizes are default
- let forced_nightly = std::env::var("ICU4X_BUILDING_WITH_FORCED_NIGHTLY").is_ok();
assert_eq!(core::mem::size_of::<subtags::Language>(), 3);
assert_eq!(core::mem::size_of::<subtags::Script>(), 4);
assert_eq!(core::mem::size_of::<subtags::Region>(), 3);
assert_eq!(core::mem::size_of::<subtags::Variant>(), 8);
- assert_eq!(core::mem::size_of::<subtags::Variants>(), 32);
- assert_eq!(core::mem::size_of::<LanguageIdentifier>(), 48);
+ assert_eq!(core::mem::size_of::<subtags::Variants>(), 16);
+ assert_eq!(core::mem::size_of::<LanguageIdentifier>(), 32);
- assert_eq!(core::mem::size_of::<extensions::transform::Transform>(), 72);
- assert_eq!(core::mem::size_of::<Option<LanguageIdentifier>>(), 48);
+ assert_eq!(core::mem::size_of::<extensions::transform::Transform>(), 56);
+ assert_eq!(core::mem::size_of::<Option<LanguageIdentifier>>(), 32);
assert_eq!(core::mem::size_of::<extensions::transform::Fields>(), 24);
assert_eq!(core::mem::size_of::<extensions::unicode::Attributes>(), 24);
- assert_eq!(
- core::mem::size_of::<extensions::unicode::Keywords>(),
- if forced_nightly { 40 } else { 48 }
- );
+ assert_eq!(core::mem::size_of::<extensions::unicode::Keywords>(), 24);
assert_eq!(core::mem::size_of::<Vec<extensions::other::Other>>(), 24);
assert_eq!(core::mem::size_of::<extensions::private::Private>(), 24);
- assert_eq!(
- core::mem::size_of::<extensions::Extensions>(),
- if forced_nightly { 184 } else { 192 }
- );
+ assert_eq!(core::mem::size_of::<extensions::Extensions>(), 152);
- assert_eq!(
- core::mem::size_of::<Locale>(),
- if forced_nightly { 232 } else { 240 }
- );
+ assert_eq!(core::mem::size_of::<Locale>(), 184);
}
impl Locale {
@@ -323,7 +312,7 @@ impl Locale {
}
}
}
- iter.next() == None
+ iter.next().is_none()
}
#[doc(hidden)]
diff --git a/vendor/icu_locid/src/ordering.rs b/vendor/icu_locid/src/ordering.rs
index b4e5c2760..c877c60c3 100644
--- a/vendor/icu_locid/src/ordering.rs
+++ b/vendor/icu_locid/src/ordering.rs
@@ -35,6 +35,7 @@ use core::cmp::Ordering;
///
/// [`Locale::strict_cmp_iter`]: crate::Locale::strict_cmp_iter
#[allow(clippy::exhaustive_enums)] // well-defined exhaustive enum semantics
+#[derive(Debug)]
pub enum SubtagOrderingResult<I> {
/// Potentially remaining subtags after the comparison operation.
Subtags(I),
diff --git a/vendor/icu_locid/src/parser/errors.rs b/vendor/icu_locid/src/parser/errors.rs
index 5cbbb2bd4..b2262460c 100644
--- a/vendor/icu_locid/src/parser/errors.rs
+++ b/vendor/icu_locid/src/parser/errors.rs
@@ -7,6 +7,8 @@ use displaydoc::Display;
/// List of parser errors that can be generated
/// while parsing [`LanguageIdentifier`](crate::LanguageIdentifier), [`Locale`](crate::Locale),
/// [`subtags`](crate::subtags) or [`extensions`](crate::extensions).
+///
+/// Re-exported as [`Error`](crate::Error).
#[derive(Display, Debug, PartialEq, Copy, Clone)]
#[non_exhaustive]
pub enum ParserError {
diff --git a/vendor/icu_locid/src/subtags/variants.rs b/vendor/icu_locid/src/subtags/variants.rs
index 3bd83f149..70aeae1d9 100644
--- a/vendor/icu_locid/src/subtags/variants.rs
+++ b/vendor/icu_locid/src/subtags/variants.rs
@@ -3,7 +3,7 @@
// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ).
use super::Variant;
-use crate::helpers::ShortVec;
+use crate::helpers::ShortSlice;
use alloc::vec::Vec;
use core::ops::Deref;
@@ -26,7 +26,7 @@ use core::ops::Deref;
/// assert_eq!(variants.to_string(), "macos-posix");
/// ```
#[derive(Default, Debug, PartialEq, Eq, Clone, Hash, PartialOrd, Ord)]
-pub struct Variants(ShortVec<Variant>);
+pub struct Variants(ShortSlice<Variant>);
impl Variants {
/// Returns a new empty list of variants. Same as [`default()`](Default::default()), but is `const`.
@@ -40,7 +40,7 @@ impl Variants {
/// ```
#[inline]
pub const fn new() -> Self {
- Self(ShortVec::new())
+ Self(ShortSlice::new())
}
/// Creates a new [`Variants`] set from a single [`Variant`].
@@ -54,7 +54,7 @@ impl Variants {
/// ```
#[inline]
pub const fn from_variant(variant: Variant) -> Self {
- Self(ShortVec::new_single(variant))
+ Self(ShortSlice::new_single(variant))
}
/// Creates a new [`Variants`] set from a [`Vec`].
@@ -77,7 +77,7 @@ impl Variants {
/// for the caller to use [`binary_search`](slice::binary_search) instead of [`sort`](slice::sort)
/// and [`dedup`](Vec::dedup()).
pub fn from_vec_unchecked(input: Vec<Variant>) -> Self {
- Self(ShortVec::from(input))
+ Self(ShortSlice::from(input))
}
/// Empties the [`Variants`] list.