summaryrefslogtreecommitdiffstats
path: root/vendor/icu_list/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_list/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_list/src')
-rw-r--r--vendor/icu_list/src/error.rs4
-rw-r--r--vendor/icu_list/src/lib.rs4
-rw-r--r--vendor/icu_list/src/list_formatter.rs5
-rw-r--r--vendor/icu_list/src/provider/mod.rs18
-rw-r--r--vendor/icu_list/src/provider/serde_dfa.rs16
5 files changed, 26 insertions, 21 deletions
diff --git a/vendor/icu_list/src/error.rs b/vendor/icu_list/src/error.rs
index d8622b03a..a338e02ed 100644
--- a/vendor/icu_list/src/error.rs
+++ b/vendor/icu_list/src/error.rs
@@ -4,12 +4,12 @@
use core::fmt::Debug;
use displaydoc::Display;
-use icu_provider::prelude::DataError;
+use icu_provider::DataError;
#[cfg(feature = "std")]
impl std::error::Error for ListError {}
-/// A list of error outcomes for various operations in the `icu_timezone` crate.
+/// A list of error outcomes for various operations in this module.
///
/// Re-exported as [`Error`](crate::Error).
#[derive(Display, Debug, Copy, Clone, PartialEq)]
diff --git a/vendor/icu_list/src/lib.rs b/vendor/icu_list/src/lib.rs
index 61aec0fa3..9412a7fb9 100644
--- a/vendor/icu_list/src/lib.rs
+++ b/vendor/icu_list/src/lib.rs
@@ -85,7 +85,7 @@
clippy::panic,
clippy::exhaustive_structs,
clippy::exhaustive_enums,
- // TODO(#2266): enable missing_debug_implementations,
+ missing_debug_implementations,
)
)]
#![warn(missing_docs)]
@@ -103,7 +103,7 @@ pub use list_formatter::*;
pub use error::ListError;
-#[doc(inline)]
+#[doc(no_inline)]
pub use ListError as Error;
/// Represents the style of a list. See the
diff --git a/vendor/icu_list/src/list_formatter.rs b/vendor/icu_list/src/list_formatter.rs
index 93f035eab..5ef67c324 100644
--- a/vendor/icu_list/src/list_formatter.rs
+++ b/vendor/icu_list/src/list_formatter.rs
@@ -9,8 +9,12 @@ use core::fmt::{self, Write};
use icu_provider::prelude::*;
use writeable::*;
+#[cfg(doc)]
+extern crate writeable;
+
/// A formatter that renders sequences of items in an i18n-friendly way. See the
/// [crate-level documentation](crate) for more details.
+#[derive(Debug)]
pub struct ListFormatter {
data: DataPayload<ErasedListV1Marker>,
length: ListLength,
@@ -151,6 +155,7 @@ pub mod parts {
/// The [`Writeable`] implementation that is returned by [`ListFormatter::format`]. See
/// the [`writeable`] crate for how to consume this.
+#[derive(Debug)]
pub struct FormattedList<'a, W: Writeable + 'a, I: Iterator<Item = W> + Clone + 'a> {
formatter: &'a ListFormatter,
values: I,
diff --git a/vendor/icu_list/src/provider/mod.rs b/vendor/icu_list/src/provider/mod.rs
index efab7c8bc..8438e956c 100644
--- a/vendor/icu_list/src/provider/mod.rs
+++ b/vendor/icu_list/src/provider/mod.rs
@@ -17,8 +17,8 @@
use crate::ListLength;
use alloc::borrow::Cow;
+use icu_provider::prelude::*;
use icu_provider::DataMarker;
-use icu_provider::{yoke, zerofrom};
mod serde_dfa;
pub use serde_dfa::SerdeDFA;
@@ -226,9 +226,10 @@ impl<'de: 'data, 'data> serde::Deserialize<'de> for ListJoinerPattern<'data> {
impl<'a> ListJoinerPattern<'a> {
/// Constructs a [`ListJoinerPattern`] from raw parts. Used by databake.
///
- /// # Safety
- /// index_1 may be at most string.len()
- pub const unsafe fn from_parts_unchecked(string: &'a str, index_1: u8) -> Self {
+ /// # Panics
+ /// If `string[..index_1]` panics.
+ pub const fn from_parts(string: &'a str, index_1: u8) -> Self {
+ assert!(string.len() <= 255 && index_1 <= string.len() as u8);
Self {
string: Cow::Borrowed(string),
index_0: 0,
@@ -243,10 +244,9 @@ impl databake::Bake for ListJoinerPattern<'_> {
env.insert("icu_list");
let string = (&*self.string).bake(env);
let index_1 = self.index_1.bake(env);
- // Safe because our own data is safe
- databake::quote! { unsafe {
- ::icu_list::provider::ListJoinerPattern::from_parts_unchecked(#string, #index_1)
- }}
+ databake::quote! {
+ ::icu_list::provider::ListJoinerPattern::from_parts(#string, #index_1)
+ }
}
}
@@ -255,7 +255,7 @@ impl databake::Bake for ListJoinerPattern<'_> {
fn databake() {
databake::test_bake!(
ListJoinerPattern,
- const: unsafe { crate::provider::ListJoinerPattern::from_parts_unchecked(", ", 2u8) },
+ const: crate::provider::ListJoinerPattern::from_parts(", ", 2u8),
icu_list
);
}
diff --git a/vendor/icu_list/src/provider/serde_dfa.rs b/vendor/icu_list/src/provider/serde_dfa.rs
index e2424e1e9..9be85fb18 100644
--- a/vendor/icu_list/src/provider/serde_dfa.rs
+++ b/vendor/icu_list/src/provider/serde_dfa.rs
@@ -3,7 +3,7 @@
// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ).
use alloc::borrow::Cow;
-use icu_provider::{yoke, zerofrom};
+use icu_provider::prelude::*;
use regex_automata::dfa::sparse::DFA;
/// A serde-compatible version of [regex_automata::dfa::sparse::DFA]. This does not implement
@@ -33,16 +33,16 @@ impl PartialEq for SerdeDFA<'_> {
impl databake::Bake for SerdeDFA<'_> {
fn bake(&self, env: &databake::CrateEnv) -> databake::TokenStream {
env.insert("icu_list");
- let le_bytes = self.deref().to_bytes_little_endian().as_slice().bake(env);
- let be_bytes = self.deref().to_bytes_big_endian().as_slice().bake(env);
+ let le_bytes = databake::Bake::bake(&self.deref().to_bytes_little_endian().as_slice(), env);
+ let be_bytes = databake::Bake::bake(&self.deref().to_bytes_big_endian().as_slice(), env);
// Safe because of `to_bytes_little_endian`/`to_bytes_big_endian`'s invariant.
databake::quote! {
unsafe {
::icu_list::provider::SerdeDFA::from_dfa_bytes_unchecked(
if cfg!(target_endian = "little") {
- &#le_bytes
+ #le_bytes
} else {
- &#be_bytes
+ #be_bytes
}
)
}
@@ -102,7 +102,7 @@ impl<'data> SerdeDFA<'data> {
// Verify safety invariant
DFA::from_bytes(&dfa_bytes).map_err(|e| {
use serde::de::Error;
- D::Error::custom(alloc::format!("Invalid DFA bytes: {}", e))
+ D::Error::custom(alloc::format!("Invalid DFA bytes: {e}"))
})?;
Ok(Some(SerdeDFA {
@@ -234,9 +234,9 @@ mod test {
databake::test_bake!(
SerdeDFA,
const: unsafe { crate::provider::SerdeDFA::from_dfa_bytes_unchecked(if cfg!(target_endian = "little") {
- &[1] // TODO: set this when activating the test
+ b"foo" // TODO: set this when activating the test
} else {
- &[2] // TODO: set this when activating the test
+ b"bar" // TODO: set this when activating the test
})},
icu_list
);