Skip to content

Commit

Permalink
Uplift repr(packed) fix to 1.4 (#5080)
Browse files Browse the repository at this point in the history
Uplifts #5049 to 1.4.x

Not strictly necessary as per policy, but might be nice to do anyway?
  • Loading branch information
Manishearth authored Jun 24, 2024
1 parent 0f65ba2 commit 694553a
Show file tree
Hide file tree
Showing 22 changed files with 129 additions and 67 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@

- Fix issue in C++ bindings where `diplomat::result::Ok` and `Err` have ambiguous template deduction errors in their constructors, on Clang. (https://github.com/unicode-org/icu4x/pull/4615)
- `[email protected]`
- Stricter version dependency on data crates
- `[email protected]`, `[email protected]`, `[email protected]`
- Enforce C,packed, not just packed, on ULE types, fixing for incoming changes to `repr(Rust)` (https://github.com/unicode-org/icu4x/pull/5049)
- `[email protected]`, `[email protected]`
- A full fix also needs `[email protected]`,`[email protected]`


## icu4x 1.4 (Nov 16, 2023)

Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion components/casemap/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ homepage.workspace = true
include.workspace = true
repository.workspace = true
rust-version.workspace = true
version.workspace = true
version = "1.4.1"

[package.metadata.docs.rs]
all-features = true
Expand Down
2 changes: 1 addition & 1 deletion components/casemap/src/provider/exceptions_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ impl ExceptionHeader {
/// In this struct the RESERVED bit is still allowed to be set, and it will produce a different
/// exception header, but it will not have any other effects.
#[derive(Copy, Clone, PartialEq, Eq, ULE)]
#[repr(packed)]
#[repr(C, packed)]
pub struct ExceptionHeaderULE {
slot_presence: SlotPresence,
bits: ExceptionBitsULE,
Expand Down
2 changes: 1 addition & 1 deletion components/properties/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name = "icu_properties"
description = "Definitions for Unicode properties"
license-file = "LICENSE"

version = "1.4.2"
version = "1.4.3"
authors.workspace = true
categories.workspace = true
edition.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion components/properties/src/provider/bidi_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ pub enum CheckedBidiPairedBracketType {
#[doc(hidden)]
/// needed for datagen but not intended for users
#[derive(Copy, Clone, Hash, PartialEq, Eq, Debug)]
#[repr(packed)]
#[repr(C, packed)]
pub struct MirroredPairedBracketDataULE([u8; 3]);

// Safety (based on the safety checklist on the ULE trait):
Expand Down
20 changes: 12 additions & 8 deletions ffi/capi/dart/package/lib/src/lib.g.dart

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

23 changes: 23 additions & 0 deletions ffi/capi/tests/missing_apis.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,27 @@
# Please check in with @Manishearth, @robertbastian, or @sffc if you have questions


icu::normalizer::uts46::Uts46Mapper#Struct
icu::normalizer::uts46::Uts46Mapper::map_normalize#FnInStruct
icu::normalizer::uts46::Uts46Mapper::new#FnInStruct
icu::normalizer::uts46::Uts46Mapper::normalize_validate#FnInStruct
icu::normalizer::uts46::Uts46Mapper::try_new#FnInStruct
icu::properties::JoiningType#Struct
icu::properties::JoiningType::DualJoining#AssociatedConstantInStruct
icu::properties::JoiningType::JoinCausing#AssociatedConstantInStruct
icu::properties::JoiningType::LeftJoining#AssociatedConstantInStruct
icu::properties::JoiningType::NonJoining#AssociatedConstantInStruct
icu::properties::JoiningType::RightJoining#AssociatedConstantInStruct
icu::properties::JoiningType::Transparent#AssociatedConstantInStruct
icu::properties::JoiningType::TryFromU32Error#AssociatedTypeInStruct
icu::properties::JoiningType::enum_to_long_name_mapper#FnInStruct
icu::properties::JoiningType::enum_to_short_name_mapper#FnInStruct
icu::properties::JoiningType::get_enum_to_long_name_mapper#FnInStruct
icu::properties::JoiningType::get_enum_to_short_name_mapper#FnInStruct
icu::properties::JoiningType::get_name_to_enum_mapper#FnInStruct
icu::properties::JoiningType::name_to_enum_mapper#FnInStruct
icu::properties::JoiningType::to_u32#FnInStruct
icu::properties::JoiningType::try_from_u32#FnInStruct
icu::properties::bidi_data::BidiAuxiliaryProperties#Struct
icu::properties::bidi_data::BidiAuxiliaryProperties::from_data#FnInStruct
icu::properties::bidi_data::BidiAuxiliaryPropertiesBorrowed#Struct
Expand All @@ -22,6 +43,8 @@ icu::properties::bidi_data::BidiAuxiliaryPropertiesBorrowed::get32_pairing_props
icu::properties::bidi_data::BidiMirroringProperties#Struct
icu::properties::bidi_data::BidiPairingProperties#Enum
icu::properties::bidi_data::bidi_auxiliary_properties#Fn
icu::properties::maps::joining_type#Fn
icu::properties::maps::load_joining_type#Fn
icu::properties::names::PropertyEnumToValueNameLinearMapper#Struct
icu::properties::names::PropertyEnumToValueNameLinearMapperBorrowed#Struct
icu::properties::names::PropertyEnumToValueNameLinearMapperBorrowed::get#FnInStruct
Expand Down
6 changes: 3 additions & 3 deletions ffi/gn/Cargo.lock

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

44 changes: 22 additions & 22 deletions ffi/gn/icu4x/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -197,17 +197,17 @@ rust_library("icu-v1_4_0") {

deps = []
deps += [ ":icu_calendar-v1_4_0" ]
deps += [ ":icu_casemap-v1_4_0" ]
deps += [ ":icu_casemap-v1_4_1" ]
deps += [ ":icu_collator-v1_4_0" ]
deps += [ ":icu_collections-v1_4_0" ]
deps += [ ":icu_datetime-v1_4_0" ]
deps += [ ":icu_decimal-v1_4_0" ]
deps += [ ":icu_list-v1_4_0" ]
deps += [ ":icu_locid-v1_4_0" ]
deps += [ ":icu_locid_transform-v1_4_0" ]
deps += [ ":icu_normalizer-v1_4_1" ]
deps += [ ":icu_normalizer-v1_4_3" ]
deps += [ ":icu_plurals-v1_4_0" ]
deps += [ ":icu_properties-v1_4_0" ]
deps += [ ":icu_properties-v1_4_3" ]
deps += [ ":icu_provider-v1_4_0" ]
deps += [ ":icu_segmenter-v1_4_0" ]
deps += [ ":icu_timezone-v1_4_0" ]
Expand Down Expand Up @@ -260,17 +260,17 @@ rust_library("icu_capi-v1_4_1") {
deps += [ ":diplomat-runtime-v0_7_0" ]
deps += [ ":fixed_decimal-v0_5_5" ]
deps += [ ":icu_calendar-v1_4_0" ]
deps += [ ":icu_casemap-v1_4_0" ]
deps += [ ":icu_casemap-v1_4_1" ]
deps += [ ":icu_collator-v1_4_0" ]
deps += [ ":icu_collections-v1_4_0" ]
deps += [ ":icu_datetime-v1_4_0" ]
deps += [ ":icu_decimal-v1_4_0" ]
deps += [ ":icu_list-v1_4_0" ]
deps += [ ":icu_locid-v1_4_0" ]
deps += [ ":icu_locid_transform-v1_4_0" ]
deps += [ ":icu_normalizer-v1_4_1" ]
deps += [ ":icu_normalizer-v1_4_3" ]
deps += [ ":icu_plurals-v1_4_0" ]
deps += [ ":icu_properties-v1_4_0" ]
deps += [ ":icu_properties-v1_4_3" ]
deps += [ ":icu_provider-v1_4_0" ]
deps += [ ":icu_provider_adapters-v1_4_0" ]
deps += [ ":icu_segmenter-v1_4_0" ]
Expand Down Expand Up @@ -304,16 +304,16 @@ rust_library("icu_capi-v1_4_1") {
visibility = [ ":*" ]
}

rust_library("icu_casemap-v1_4_0") {
rust_library("icu_casemap-v1_4_1") {
crate_name = "icu_casemap"
crate_root = "//components/casemap/src/lib.rs"
output_name = "icu_casemap-cbaadac30fa1a00b"
output_name = "icu_casemap-dcd3c1c9f13af18b"

deps = []
deps += [ ":displaydoc-v0_2_4($host_toolchain)" ]
deps += [ ":icu_collections-v1_4_0" ]
deps += [ ":icu_locid-v1_4_0" ]
deps += [ ":icu_properties-v1_4_0" ]
deps += [ ":icu_properties-v1_4_3" ]
deps += [ ":icu_provider-v1_4_0" ]
deps += [ ":writeable-v0_5_4" ]
deps += [ ":zerovec-v0_10_1" ]
Expand All @@ -323,8 +323,8 @@ rust_library("icu_casemap-v1_4_0") {
rustflags = [
"--cap-lints=allow",
"--edition=2021",
"-Cmetadata=cbaadac30fa1a00b",
"-Cextra-filename=-cbaadac30fa1a00b",
"-Cmetadata=dcd3c1c9f13af18b",
"-Cextra-filename=-dcd3c1c9f13af18b",
]

visibility = [ ":*" ]
Expand All @@ -339,8 +339,8 @@ rust_library("icu_collator-v1_4_0") {
deps += [ ":displaydoc-v0_2_4($host_toolchain)" ]
deps += [ ":icu_collections-v1_4_0" ]
deps += [ ":icu_locid-v1_4_0" ]
deps += [ ":icu_normalizer-v1_4_1" ]
deps += [ ":icu_properties-v1_4_0" ]
deps += [ ":icu_normalizer-v1_4_3" ]
deps += [ ":icu_properties-v1_4_3" ]
deps += [ ":icu_provider-v1_4_0" ]
deps += [ ":smallvec-v1_10_0" ]
deps += [ ":utf16_iter-v1_0_4" ]
Expand Down Expand Up @@ -510,15 +510,15 @@ rust_library("icu_locid_transform-v1_4_0") {
visibility = [ ":*" ]
}

rust_library("icu_normalizer-v1_4_1") {
rust_library("icu_normalizer-v1_4_3") {
crate_name = "icu_normalizer"
crate_root = "//components/normalizer/src/lib.rs"
output_name = "icu_normalizer-95d3055564b72a64"
output_name = "icu_normalizer-93d3ddd5c25aaf29"

deps = []
deps += [ ":displaydoc-v0_2_4($host_toolchain)" ]
deps += [ ":icu_collections-v1_4_0" ]
deps += [ ":icu_properties-v1_4_0" ]
deps += [ ":icu_properties-v1_4_3" ]
deps += [ ":icu_provider-v1_4_0" ]
deps += [ ":smallvec-v1_10_0" ]
deps += [ ":utf16_iter-v1_0_4" ]
Expand All @@ -531,8 +531,8 @@ rust_library("icu_normalizer-v1_4_1") {
rustflags = [
"--cap-lints=allow",
"--edition=2021",
"-Cmetadata=95d3055564b72a64",
"-Cextra-filename=-95d3055564b72a64",
"-Cmetadata=93d3ddd5c25aaf29",
"-Cextra-filename=-93d3ddd5c25aaf29",
]

visibility = [ ":*" ]
Expand Down Expand Up @@ -562,10 +562,10 @@ rust_library("icu_plurals-v1_4_0") {
visibility = [ ":*" ]
}

rust_library("icu_properties-v1_4_0") {
rust_library("icu_properties-v1_4_3") {
crate_name = "icu_properties"
crate_root = "//components/properties/src/lib.rs"
output_name = "icu_properties-dacf022aed7923a8"
output_name = "icu_properties-a28d00ec1785b300"

deps = []
deps += [ ":displaydoc-v0_2_4($host_toolchain)" ]
Expand All @@ -580,8 +580,8 @@ rust_library("icu_properties-v1_4_0") {
rustflags = [
"--cap-lints=allow",
"--edition=2021",
"-Cmetadata=dacf022aed7923a8",
"-Cextra-filename=-dacf022aed7923a8",
"-Cmetadata=a28d00ec1785b300",
"-Cextra-filename=-a28d00ec1785b300",
"--cfg=feature=\"bidi\"",
]

Expand Down
4 changes: 4 additions & 0 deletions provider/datagen/tests/data/postcard/fingerprints.csv
Original file line number Diff line number Diff line change
Expand Up @@ -4889,6 +4889,7 @@ propnames/from/ccc@1, und, 783B, 38e394b20d58c1df
propnames/from/ea@1, und, 105B, 4bc69f982fa6b2de
propnames/from/gc@1, und, 747B, 2f7ece7581036df2
propnames/from/gcm@1, und, 907B, 43b812154d2d3914
propnames/from/jt@1, und, 131B, b45c742d4b17ceb
propnames/from/lb@1, und, 963B, bb6e2daf75e2057f
propnames/from/sc@1, und, 3640B, d1ed7fca398b05b8
propnames/to/long/linear/GCB@1, und, 151B, 9feae38a09898348
Expand All @@ -4898,6 +4899,7 @@ propnames/to/long/linear/WB@1, und, 245B, 7d725adfd056f4a4
propnames/to/long/linear/bc@1, und, 460B, 98758a587d562ad1
propnames/to/long/linear/ea@1, und, 61B, b4df37d762a5c879
propnames/to/long/linear/gc@1, und, 488B, 4786f3c0d2d639d
propnames/to/long/linear/jt@1, und, 88B, d9b49c75470a1afa
propnames/to/long/linear/lb@1, und, 598B, 6ee04a546e351ffb
propnames/to/long/linear/sc@1, und, 1964B, 9b97b7f85684632c
propnames/to/long/sparse/ccc@1, und, 652B, 440a07537c221a20
Expand All @@ -4908,6 +4910,7 @@ propnames/to/short/linear/WB@1, und, 111B, 625b4965d4282611
propnames/to/short/linear/bc@1, und, 103B, 85ea5db229b1eaba
propnames/to/short/linear/ea@1, und, 24B, 9dcf5f0ed5697f5b
propnames/to/short/linear/gc@1, und, 125B, a6da6a4499b7361b
propnames/to/short/linear/jt@1, und, 23B, 4f7c0d697e2b792f
propnames/to/short/linear/lb@1, und, 199B, 808bb5403b659e4
propnames/to/short/linear4/sc@1, und, 806B, d488da3356b27392
propnames/to/short/sparse/ccc@1, und, 478B, aa23b3caa16eae5e
Expand Down Expand Up @@ -5071,6 +5074,7 @@ props/exemplarchars/punctuation@1, tr, 123B, 2e7906785ab47589
props/exemplarchars/punctuation@1, und, 59B, 42e553f11527bac0
props/gc@1, und, 17012B, 1d6406352436488b
props/graph@1, und, 5707B, 2fd03ad84767b721
props/jt@1, und, 6915B, 877aaf1128f9f651
props/lb@1, und, 14856B, 9add7e1b9033c67d
props/nfcinert@1, und, 7211B, f1234f4fe31e6a0d
props/nfdinert@1, und, 3267B, 20cfe23fc3115a5d
Expand Down
4 changes: 3 additions & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@

[toolchain]
# Version updated on 2023-10-06
channel = "1.73"
# Version set to 1.74 for release/1.4 branch on 2024-06-20
# so that cargo-rdme continues to install
channel = "1.74"
4 changes: 2 additions & 2 deletions utils/zerovec/derive/examples/derives.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use zerovec::ule::AsULE;
use zerovec::ule::EncodeAsVarULE;
use zerovec::*;

#[repr(packed)]
#[repr(C, packed)]
#[derive(ule::ULE, Copy, Clone)]
pub struct FooULE {
a: u8,
Expand Down Expand Up @@ -40,7 +40,7 @@ impl AsULE for Foo {
}
}

#[repr(packed)]
#[repr(C, packed)]
#[derive(ule::VarULE)]
pub struct RelationULE {
/// This maps to (AndOr, Polarity, Operand),
Expand Down
2 changes: 1 addition & 1 deletion utils/zerovec/derive/src/make_ule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ fn make_ule_enum_impl(
attrs: ZeroVecAttrs,
) -> TokenStream2 {
// We could support more int reprs in the future if needed
if !utils::has_valid_repr(&input.attrs, |r| r == "u8") {
if !utils::ReprInfo::compute(&input.attrs).u8 {
return Error::new(
input.span(),
"#[make_ule] can only be applied to #[repr(u8)] enums",
Expand Down
4 changes: 2 additions & 2 deletions utils/zerovec/derive/src/ule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ use syn::spanned::Spanned;
use syn::{Data, DeriveInput, Error};

pub fn derive_impl(input: &DeriveInput) -> TokenStream2 {
if !utils::has_valid_repr(&input.attrs, |r| r == "packed" || r == "transparent") {
if !utils::ReprInfo::compute(&input.attrs).cpacked_or_transparent() {
return Error::new(
input.span(),
"derive(ULE) must be applied to a #[repr(packed)] or #[repr(transparent)] type",
"derive(ULE) must be applied to a #[repr(C, packed)] or #[repr(transparent)] type",
)
.to_compile_error();
}
Expand Down
Loading

0 comments on commit 694553a

Please sign in to comment.