Skip to content

Commit 7b6717d

Browse files
committed
Use checked_sub instead of saturating_sub
1 parent 4b53141 commit 7b6717d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/shims/time.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
176176
("tm_hour", dt.hour().into()),
177177
("tm_mday", dt.day().into()),
178178
("tm_mon", dt.month0().into()),
179-
("tm_year", dt.year().saturating_sub(1900).into()),
179+
("tm_year", dt.year().checked_sub(1900).unwrap().into()),
180180
("tm_wday", dt.weekday().num_days_from_sunday().into()),
181181
("tm_yday", dt.ordinal0().into()),
182182
("tm_isdst", tm_isdst),

0 commit comments

Comments
 (0)