Skip to content

Commit 41ccd85

Browse files
committed
Merge remote-tracking branch 'upstream/main' into segmenter
2 parents c93669e + b752157 commit 41ccd85

File tree

169 files changed

+10190
-1721
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

169 files changed

+10190
-1721
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
# Changelog
22

33
## Unreleased
4-
4+
- Components
5+
- `icu_properties`
6+
- Fix some property constants (unicode-org#7269, unicode-org#7281, unicode-org#7284)
7+
- Add conversions for `unicode_bidi::BidiClass` (unicode-org#7272)
8+
- Add `IndicConjunctBreak` (unicode-org#7280)
59
- Utils
610
- Retire the `icu_harfbuzz` crate. The `icu_properties` and `icu_normalizer` types now directly implement the `harfbuzz-traits`
711

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,4 +344,5 @@ type_method_marked_deprecated.level = "allow" # allow deprecation in patch relea
344344
trait_method_marked_deprecated.level = "allow" # allow deprecation in patch releases
345345
type_marked_deprecated.level = "allow" # allow deprecation in patch releases
346346
struct_field_marked_deprecated = "allow" # allow deprecation in patch releases
347+
type_associated_const_marked_deprecated = "allow" # allow deprecation in patch releases
347348
enum_no_repr_variant_discriminant_changed = "allow" # we don't consider this breaking https://github.com/obi1kenobi/cargo-semver-checks/issues/1376

components/calendar/README.md

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/calendar/benches/date.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use criterion::{
2222
};
2323
use icu_calendar::{
2424
options::{DateAddOptions, Overflow},
25-
types, AsCalendar, Calendar, Date,
25+
types, AsCalendar, Calendar, Date, Iso,
2626
};
2727

2828
fn bench_date<A: AsCalendar>(date: &mut Date<A>) {
@@ -48,7 +48,7 @@ fn bench_date<A: AsCalendar>(date: &mut Date<A>) {
4848
let _ = black_box(date.day_of_month());
4949

5050
// Conversion to ISO.
51-
let _ = black_box(date.to_iso());
51+
let _ = black_box(date.to_calendar(Iso));
5252
}
5353

5454
fn bench_calendar<C: Clone + Calendar>(
@@ -67,7 +67,7 @@ fn bench_calendar<C: Clone + Calendar>(
6767

6868
// Conversion from ISO
6969
let date_iso = Date::try_new_iso(fx.year, fx.month, fx.day).unwrap();
70-
let mut converted_date_calendar = Date::new_from_iso(date_iso, calendar.clone());
70+
let mut converted_date_calendar = date_iso.to_calendar(calendar.clone());
7171

7272
bench_date(&mut instantiated_date_calendar);
7373
bench_date(&mut converted_date_calendar);

components/calendar/fuzz/fuzz_targets/construction.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ struct FuzzInput {
2121
fuzz_target!(|data: FuzzInput| {
2222
if let Some(date) = data.ymd.to_date(data.cal, data.overflow_constrain) {
2323
let _ = date.day_of_month();
24-
let _ = date.day_of_week();
24+
let _ = date.weekday();
2525
let _ = date.day_of_year();
2626
let _ = date.days_in_month();
2727
let _ = date.days_in_year();

components/calendar/src/any_calendar.rs

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,7 @@ impl<C: AsCalendar<Calendar = AnyCalendar>> Date<C> {
727727
/// Convert this `Date<AnyCalendar>` to another `AnyCalendar`, if conversion is needed
728728
pub fn convert_any<'a>(&self, calendar: &'a AnyCalendar) -> Date<Ref<'a, AnyCalendar>> {
729729
if calendar.kind() != self.calendar.as_calendar().kind() {
730-
Date::new_from_iso(self.to_iso(), Ref(calendar))
730+
self.to_calendar(Ref(calendar))
731731
} else {
732732
Date {
733733
inner: self.inner,
@@ -1540,6 +1540,16 @@ impl From<Roc> for AnyCalendar {
15401540
}
15411541
}
15421542

1543+
impl<C: IntoAnyCalendar> Date<C> {
1544+
/// Type-erase the date, converting it to a date for [`AnyCalendar`]
1545+
pub fn to_any(self) -> Date<AnyCalendar> {
1546+
Date::from_raw(
1547+
self.calendar.date_to_any(&self.inner),
1548+
self.calendar.to_any(),
1549+
)
1550+
}
1551+
}
1552+
15431553
#[cfg(test)]
15441554
mod tests {
15451555
use super::*;
@@ -1561,27 +1571,22 @@ mod tests {
15611571
)
15621572
});
15631573

1564-
let roundtrip_year = date.year();
1565-
let roundtrip_month = date.month().value;
1566-
let roundtrip_day = date.day_of_month().0;
1567-
15681574
assert_eq!(
15691575
(month, day),
1570-
(roundtrip_month, roundtrip_day),
1576+
(date.month().value, date.day_of_month().0),
15711577
"Failed to roundtrip for calendar {}",
15721578
calendar.debug_name()
15731579
);
15741580

15751581
if let Some((era_code, era_index)) = era {
15761582
let roundtrip_era_year = date.year().era().expect("year type should be era");
15771583

1578-
let roundtrip_year = roundtrip_year.era_year_or_related_iso();
15791584
assert_eq!(
15801585
(era_code, era_index, year),
15811586
(
15821587
roundtrip_era_year.era.as_str(),
15831588
roundtrip_era_year.era_index,
1584-
roundtrip_year
1589+
roundtrip_era_year.year,
15851590
),
15861591
"Failed to roundtrip era for calendar {}",
15871592
calendar.debug_name()
@@ -1595,10 +1600,9 @@ mod tests {
15951600
);
15961601
}
15971602

1598-
let iso = date.to_iso();
1599-
let reconstructed = Date::new_from_iso(iso, calendar);
16001603
assert_eq!(
1601-
date, reconstructed,
1604+
Date::from_rata_die(date.to_rata_die(), calendar),
1605+
date,
16021606
"Failed to roundtrip via iso with {era:?}, {year}, {month:?}, {day}"
16031607
)
16041608
}

0 commit comments

Comments
 (0)