Skip to content

Commit

Permalink
Make TimeZoneInfo more strict (#5700)
Browse files Browse the repository at this point in the history
  • Loading branch information
sffc authored Oct 18, 2024
1 parent 3372ea7 commit 5ad31bf
Show file tree
Hide file tree
Showing 35 changed files with 949 additions and 338 deletions.
10 changes: 6 additions & 4 deletions components/datetime/benches/datetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ mod fixtures;
use criterion::{criterion_group, criterion_main, Criterion};
use icu_datetime::neo::TypedNeoFormatter;

use icu_calendar::{DateTime, Gregorian};
use icu_calendar::{Date, DateTime, Gregorian, Time};
use icu_locale_core::Locale;
use icu_timezone::{CustomZonedDateTime, TimeZoneInfo};
use icu_timezone::{CustomZonedDateTime, TimeZoneInfo, ZoneVariant};
use writeable::TryWriteable;

#[path = "../tests/mock.rs"]
Expand All @@ -23,7 +23,7 @@ fn datetime_benches(c: &mut Criterion) {
group.bench_function(format!("semantic/{name}"), |b| {
b.iter(|| {
for fx in &fxs.0 {
let datetimes: Vec<CustomZonedDateTime<Gregorian>> = fx
let datetimes: Vec<CustomZonedDateTime<Gregorian, _>> = fx
.values
.iter()
.map(move |value| {
Expand All @@ -35,7 +35,9 @@ fn datetime_benches(c: &mut Criterion) {
date,
time,
// zone is unused but we need to make the types match
zone: TimeZoneInfo::utc(),
zone: TimeZoneInfo::utc()
.at_time((Date::unix_epoch(), Time::midnight()))
.with_zone_variant(ZoneVariant::standard()),
}
}
})
Expand Down
4 changes: 2 additions & 2 deletions components/datetime/src/format/neo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,13 +365,13 @@ size_test!(
/// use icu::datetime::{DateTimeWriteError, TypedDateTimeNames};
/// use icu::datetime::fields::{Field, FieldLength, FieldSymbol, Weekday};
/// use icu::datetime::neo_pattern::DateTimePattern;
/// use icu::datetime::neo_skeleton::NeoTimeZoneSkeleton;
/// use icu::datetime::neo_marker::NeoTimeZoneOffsetMarker;
/// use icu::locale::locale;
/// use icu::timezone::TimeZoneInfo;
/// use writeable::{Part, assert_try_writeable_parts_eq};
///
/// // Create an instance that can format abbreviated month, weekday, and day period names:
/// let mut names: TypedDateTimeNames<Gregorian, NeoTimeZoneSkeleton> =
/// let mut names: TypedDateTimeNames<Gregorian, NeoTimeZoneOffsetMarker> =
/// TypedDateTimeNames::try_new(&locale!("en").into()).unwrap();
///
/// // Create a pattern from a pattern string:
Expand Down
2 changes: 1 addition & 1 deletion components/datetime/src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
//! formatting operations.
use crate::neo_marker::{DateInputMarkers, GetField, TimeMarkers, ZoneMarkers};
use crate::scaffold::IntoOption;
use icu_calendar::any_calendar::AnyCalendarKind;
use icu_calendar::{Date, Iso, Time};
use icu_timezone::scaffold::IntoOption;
use icu_timezone::{TimeZoneBcp47Id, UtcOffset, ZoneVariant};

// TODO(#2630) fix up imports to directly import from icu_calendar
Expand Down
1 change: 1 addition & 0 deletions components/datetime/src/neo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ use icu_calendar::provider::{
use icu_calendar::AnyCalendar;
use icu_decimal::provider::DecimalSymbolsV1Marker;
use icu_provider::prelude::*;
use icu_timezone::scaffold::IntoOption;
use writeable::TryWriteable;

/// Helper macro for generating any/buffer constructors in this file.
Expand Down
Loading

0 comments on commit 5ad31bf

Please sign in to comment.