Closed
Description
Hello!
It looks like the following code, which used to work fine on time
0.3.17, now fails on 0.3.18 and 0.3.19:
use std::time::SystemTime;
use time::ext::NumericalDuration;
use time::OffsetDateTime;
fn main() {
let now = OffsetDateTime::now_utc();
let one_hour = 1.hours();
let _: SystemTime = (now+one_hour*2).into();
}
It gives this error:
Compiling test-time v0.1.0 (/home/nickm/src/test-time)
error[E0282]: type annotations needed
--> src/main.rs:9:25
|
9 | let _: SystemTime = (now+one_hour*2).into();
| ^^^^^^^^^^^^^^^^ cannot infer type
The last line works fine if you remove the * 2
, or if you replace one_hour * 2
with 2.hours()
, or if you replace the whole expression with SystemTime::from(now+one_hour*2)
.