File tree Expand file tree Collapse file tree 2 files changed +27
-6
lines changed Expand file tree Collapse file tree 2 files changed +27
-6
lines changed Original file line number Diff line number Diff line change @@ -140,11 +140,21 @@ mod unstable {
140140 ///
141141 /// assert!(matches!(
142142 /// err,
143- /// DateFromFieldsError::Range(RangeError { field: "month", .. })
144- /// )) ;
143+ /// DateFromFieldsError::Range { field: "month", .. })
144+ /// );
145145 /// ```
146- #[ displaydoc( "{0}" ) ]
147- Range ( RangeError ) ,
146+ #[ displaydoc( "The {field} = {value} argument is out of range {min}..={max}" ) ]
147+ #[ non_exhaustive]
148+ Range {
149+ /// The field that is out of range, such as "year"
150+ field : & ' static str ,
151+ /// The actual value
152+ value : i32 ,
153+ /// The minimum value (inclusive). This might not be tight.
154+ min : i32 ,
155+ /// The maximum value (inclusive). This might not be tight.
156+ max : i32 ,
157+ } ,
148158 /// The era code is invalid for the calendar.
149159 #[ displaydoc( "Unknown era or invalid syntax" ) ]
150160 UnknownEra ,
@@ -318,7 +328,18 @@ mod unstable {
318328 impl From < RangeError > for DateFromFieldsError {
319329 #[ inline]
320330 fn from ( value : RangeError ) -> Self {
321- DateFromFieldsError :: Range ( value)
331+ let RangeError {
332+ field,
333+ value,
334+ min,
335+ max,
336+ } = value;
337+ DateFromFieldsError :: Range {
338+ field,
339+ value,
340+ min,
341+ max,
342+ }
322343 }
323344 }
324345}
Original file line number Diff line number Diff line change @@ -216,7 +216,7 @@ impl From<icu_calendar::DateError> for CalendarError {
216216impl From < icu_calendar:: error:: DateFromFieldsError > for CalendarDateFromFieldsError {
217217 fn from ( e : icu_calendar:: error:: DateFromFieldsError ) -> Self {
218218 match e {
219- icu_calendar:: error:: DateFromFieldsError :: Range ( _ ) => Self :: OutOfRange ,
219+ icu_calendar:: error:: DateFromFieldsError :: Range { .. } => Self :: OutOfRange ,
220220 icu_calendar:: error:: DateFromFieldsError :: UnknownEra => Self :: UnknownEra ,
221221 icu_calendar:: error:: DateFromFieldsError :: MonthCodeInvalidSyntax => {
222222 Self :: MonthCodeInvalidSyntax
You can’t perform that action at this time.
0 commit comments