Skip to content

Commit bca8cae

Browse files
committed
Fix benchmark and set AnyCalendarDifferenceError to hidden
1 parent 4b03c6d commit bca8cae

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

components/calendar/benches/date.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,16 @@ pub struct Test {
2020
use criterion::{
2121
black_box, criterion_group, criterion_main, measurement::WallTime, BenchmarkGroup, Criterion,
2222
};
23-
use icu_calendar::{types, AsCalendar, Calendar, Date};
23+
use icu_calendar::{
24+
options::{DateAddOptions, Overflow},
25+
types, AsCalendar, Calendar, Date,
26+
};
2427

2528
fn bench_date<A: AsCalendar>(date: &mut Date<A>) {
2629
// black_box used to avoid compiler optimization.
2730
// Arithmetic
31+
let mut options = DateAddOptions::default();
32+
options.overflow = Some(Overflow::Constrain);
2833
date.try_add_with_options(
2934
types::DateDuration {
3035
is_negative: false,
@@ -33,7 +38,7 @@ fn bench_date<A: AsCalendar>(date: &mut Date<A>) {
3338
weeks: black_box(3),
3439
days: black_box(4),
3540
},
36-
Default::default(),
41+
options,
3742
)
3843
.unwrap();
3944

components/calendar/src/any_calendar.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ macro_rules! match_cal {
247247
/// Error returned when comparing two [`Date`]s with [`AnyCalendar`].
248248
#[derive(Clone, Copy, PartialEq, Debug)]
249249
#[non_exhaustive]
250+
#[doc(hidden)] // unstable, not yet graduated
250251
pub enum AnyCalendarDifferenceError {
251252
/// The calendars of the two dates being compared are not equal.
252253
///

0 commit comments

Comments
 (0)