-
Notifications
You must be signed in to change notification settings - Fork 242
Don't enable icu_provider/alloc from component crates
#7211
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm very wary of similar problems recurring similar to the last release.
I think the main problem that could happen here is if some component relied on a dependency crate to enable icu_provider/alloc. I think it's fine since otherwise you would have had to add an icu_provider/alloc somewhere here to pass CI. But I would prefer this be double-checked somehow.
Perhaps update all cfg(feature = "alloc") in icu_provider to alloc2 or something and ensure that the only crates which break are the ones with explicit icu_provider + alloc deps?
| #[cfg(feature = "alloc")] | ||
| pub mod hello_world; | ||
|
|
||
| // TODO: put this in a separate crate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't want to have to tie this change to this PR: can this be done separately?
I'm opposed to this being in a new util crate. I'd rather it be inlined in experimental, and if it is not to be inlined, we should probably follow the "copy around utils files" model we agreed upon in #4467 (comment) for shared macro code.
I don't think this two-line crate meets the bar of a utils crate. I know it's fixing what some of us view as a deficiency in the serde ecosystem, but as it stands I do not see the ecosystem picking this up, so it becomes yet another ICU4X specific util that, to me, doesn't seem to pull its weight.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't want them inlined in icu_experimental because we want these available to other ICU4X component crates. These helpers exist to work around a bug in Serde (serde-rs/serde#2072). They've previously been used by others, and I guess at the moment icu_experimental is the only one using them, but when we start graduating things from icu_experimental, then we need them in both places again.
I agree that these helpers are probably better suited for icu4x_shared.rs. However, moving these out of icu_provider breaks our internal stability policy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
However, moving these out of icu_provider breaks our internal stability policy.
Only if it is used by released icu non-experimental crates, right? (I was meaning to check this but I wanted this split out either way so as not to bog this issue down)
But I just checked, datetime in 2.0 uses this code. So yes, we cannot remove this in the 2.x stream.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The internal stability policy is about ease of integration, not promises made to clients, so even if this was used in only icu_experimental, I think we would still want to stick to it. Obviously this is an internal policy and we can always make exceptions to it, but exceptions should have justification.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The internal stability policy is about ease of integration, not promises made to clients
Yes, I know, I was the one who pushed for the policy.
I didn't intend for icu_experimental to be a part of that since icu_experimental breaks ease of client integration anyway. I don't consider this an exception. But it's moot anyway.
|
The 2.0.x component crates I released rely on |
sffc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you clarify why the alloc feature increases the size of DataPayload?
I wonder if we could instead split the alloc feature in two, where alloc enables the new APIs like serde_borrow_de_utils and bubbles down to sub-crates, and alloc_bikeshed does things that change DataPayload.
|
I guess it doesn't actually increase the size unless the compiler can optimize /// The actual cart type (private typedef).
#[cfg(feature = "alloc")]
pub(crate) type CartInner = SelectedRc<Box<[u8]>>;
#[cfg(not(feature = "alloc"))]
pub(crate) type CartInner = &'static ();It does however makes the struct not |
| icu_locale_core = { workspace = true, features = ["alloc"] } | ||
| icu_properties = { workspace = true } | ||
| icu_provider = { workspace = true, features = ["alloc"] } | ||
| icu_provider = { workspace = true } |
There was a problem hiding this comment.
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.
|
@robertbastian Figured it out: Assuming the serde stuff is undone, the issue is not between component crates; it is for users of ICU4X If I am a user of This is probably a minor issue. Questions:
I think we lucked out by versioning policy here: all crates which depend on |
|
WG notes:
|
|
As long as this change doesn't break 2.0.x and 2.1.x crates, I approve the change to the Cargo.toml files. We still must figure out what to do with the serde utils. |
| 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"] |
There was a problem hiding this comment.
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.
This makes the
DataPayloadbigger, and notSend+Syncwithout thesyncfeature. We shouldn't enableicu_provider/allocjust to getzerofrom/allocandyoke/alloc.