Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 6 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion components/casemap/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ all-features = true
icu_collections = { workspace = true, features = ["alloc"] }
icu_locale_core = { workspace = true, features = ["alloc"] }
icu_properties = { workspace = true }
icu_provider = { workspace = true, features = ["alloc"] }
icu_provider = { workspace = true }
Copy link
Member

@sffc sffc Nov 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue: This PR breaks the meaning of the alloc feature in the 2.0.x and 2.1.x component crates. Changing no-default-features behavior is not forbidden, but given that this is a low-level crate, we should do such a change only if it is better than feasible alternatives.

I think splitting the alloc feature into two pieces, as suggested before, would be an example of a feasible alternative. There might be others.

potential_utf = { workspace = true, features = ["alloc", "zerovec"] }
writeable = { workspace = true }
zerofrom = { workspace = true, features = ["alloc"] }
zerovec = { workspace = true, features = ["alloc", "yoke"] }

databake = { workspace = true, features = ["derive"], optional = true}
Expand Down
3 changes: 2 additions & 1 deletion components/datetime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ icu_time = { workspace = true, features = ["alloc"] }
tinystr = { workspace = true, features = ["alloc", "zerovec"] }
potential_utf = { workspace = true, features = ["alloc", "zerovec"] }
writeable = { workspace = true }
zerofrom = { workspace = true }
zerovec = { workspace = true, features = ["alloc", "yoke"] }
yoke = { workspace = true, features = ["alloc"] }

serde = { workspace = true, features = ["derive", "alloc"], optional = true }
zerotrie = { workspace = true, features = ["alloc"], optional = true }
Expand Down Expand Up @@ -70,7 +72,6 @@ serde = [
"icu_decimal/serde",
"icu_pattern/serde",
"icu_plurals/serde",
"icu_provider/alloc",
"icu_provider/serde",
"icu_time/serde",
"litemap?/serde",
Expand Down
3 changes: 2 additions & 1 deletion components/experimental/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ potential_utf = { workspace = true, features = ["zerovec"] }
writeable = { workspace = true }
zerotrie = { workspace = true, features = ["yoke", "zerofrom"] }
zerovec = { workspace = true, features = ["alloc", "derive", "yoke"] }
yoke = { workspace = true, features = ["alloc"] }

displaydoc = { workspace = true }
log = { workspace = true, optional = true }
Expand Down Expand Up @@ -73,7 +74,7 @@ default = ["compiled_data"]
compiled_data = ["dep:icu_experimental_data", "icu_decimal/compiled_data", "icu_list/compiled_data", "icu_plurals/compiled_data", "icu_properties/compiled_data", "icu_normalizer/compiled_data", "icu_casemap/compiled_data", "icu_provider/baked"]
datagen = ["serde", "dep:databake", "zerovec/databake", "zerotrie/databake", "tinystr/databake", "icu_collections/databake", "log", "icu_pattern/databake", "icu_plurals/datagen", "icu_pattern/alloc", "icu_provider/export"]
ryu = ["fixed_decimal/ryu"]
serde = ["dep:serde", "zerovec/serde", "potential_utf/serde", "tinystr/serde", "icu_collections/serde", "icu_decimal/serde", "icu_list/serde", "icu_pattern/serde", "icu_plurals/serde", "icu_provider/alloc", "icu_provider/serde", "zerotrie/serde", "icu_normalizer/serde", "icu_casemap/serde"]
serde = ["dep:serde", "zerovec/serde", "potential_utf/serde", "tinystr/serde", "icu_collections/serde", "icu_decimal/serde", "icu_list/serde", "icu_pattern/serde", "icu_plurals/serde", "icu_provider/serde", "zerotrie/serde", "icu_normalizer/serde", "icu_casemap/serde"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thought/Suggestion: I don't find it objectionable for icu_experimental/serde to enable icu_provider/alloc. I think it's probably better than duplicating the serde util code.


[[bench]]
name = "transliterate"
Expand Down
16 changes: 14 additions & 2 deletions components/experimental/src/personnames/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ use alloc::borrow::Cow;
use core::fmt::{Debug, Formatter};

use icu_provider::prelude::*;
#[cfg(feature = "serde")]
use icu_provider::serde_borrow_de_utils::option_of_cow;
use zerovec::VarZeroVec;

use crate::personnames::api::FormattingFormality;
Expand Down Expand Up @@ -86,6 +84,20 @@ pub struct PersonNamesFormat<'data> {
pub person_names_patterns: VarZeroVec<'data, PersonNamesFormattingDataVarULE>,
}

#[cfg_attr(feature = "serde", derive(serde::Deserialize))]
#[serde(transparent)]
// Cows fail to borrow in some situations (array, option), but structs of Cows don't.
struct CowWrap<'data>(#[serde(borrow)] Cow<'data, str>);

#[cfg(feature = "serde")]
fn option_of_cow<'de, D>(deserializer: D) -> Result<Option<Cow<'de, str>>, D::Error>
where
D: serde::Deserializer<'de>,
{
use serde::Deserialize;
<Option<CowWrap<'de>>>::deserialize(deserializer).map(|opt| opt.map(|wrap| wrap.0))
}

icu_provider::data_struct!(PersonNamesFormat<'_>, #[cfg(feature = "datagen")]);

/// Person Name Attributes.
Expand Down
7 changes: 4 additions & 3 deletions components/list/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ all-features = true
icu_provider = { workspace = true }
regex-automata = { workspace = true, features = ["dfa-search"] }
writeable = { workspace = true }
zerovec = { workspace = true, features = ["alloc"] }
zerofrom = { workspace = true }
zerovec = { workspace = true }

databake = { workspace = true, features = ["derive"], optional = true}
serde = { workspace = true, features = ["derive"], optional = true }
Expand All @@ -39,8 +40,8 @@ serde_json = { workspace = true }

[features]
default = ["compiled_data"]
serde = ["dep:serde", "icu_provider/serde", "icu_provider/alloc", "zerovec/serde"]
serde = ["dep:serde", "icu_provider/serde", "zerovec/serde", "zerovec/alloc"]
serde_human = ["serde", "regex-automata/dfa-build", "regex-automata/syntax", "alloc"]
datagen = ["serde", "dep:databake", "regex-automata/dfa-build", "regex-automata/syntax", "zerovec/databake", "alloc", "serde_human", "icu_provider/export"]
compiled_data = ["dep:icu_list_data", "dep:icu_locale", "icu_locale?/compiled_data", "icu_provider/baked"]
alloc = ["zerovec/alloc", "icu_provider/alloc", "serde?/alloc"]
alloc = ["writeable/alloc", "zerofrom/alloc", "zerovec/alloc", "serde?/alloc"]
3 changes: 2 additions & 1 deletion components/locale/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@ all-features = true
[dependencies]
databake = { workspace = true, optional = true, features = ["derive"] }
icu_locale_core = { workspace = true, features = ["alloc", "zerovec"] }
icu_provider = { workspace = true, features = ["alloc"] }
icu_provider = { workspace = true }
serde = { workspace = true, features = ["derive", "alloc"], optional = true }
tinystr = { workspace = true, features = ["alloc", "zerovec"] }
potential_utf = { workspace = true, features = ["alloc", "zerovec"] }
zerovec = { workspace = true, features = ["alloc", "yoke"] }
zerofrom = { workspace = true, features = ["alloc"] }

icu_collections = { workspace = true }

Expand Down
2 changes: 1 addition & 1 deletion components/plurals/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ all-features = true

[dependencies]
fixed_decimal = { workspace = true }
icu_provider = { workspace = true, features = ["alloc"] }
icu_provider = { workspace = true }
zerovec = { workspace = true, features = ["alloc", "yoke"] }

databake = { workspace = true, features = ["derive"], optional = true}
Expand Down
1 change: 0 additions & 1 deletion provider/blob/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ databake = { path = "../../utils/databake" }
icu_provider_export = { path = "../../provider/export" }
icu_locale = { path = "../../components/locale", default-features = false, features = ["compiled_data"] }
icu_locale_core = { path = "../../components/locale_core", default-features = false, features = ["serde"] }
icu_provider = { path = "../../provider/core", features = ["alloc"] }
icu_provider_adapters = { path = "../../provider/adapters", default-features = false }
twox-hash = { workspace = true }

Expand Down
Loading