printpdf icon indicating copy to clipboard operation
printpdf copied to clipboard

Build error with time crate dependency

Open qtfkwk opened this issue 4 years ago • 2 comments

error: expected an item keyword
   --> /home/qtfkwk/.cargo/registry/src/github.com-1ecc6299db9ec823/time-0.2.8/src/utc_offset.rs:366:13
    |
366 |             let tm = timestamp_to_tm(datetime.timestamp())?;
    |             ^^^
    |
   ::: /home/qtfkwk/.cargo/registry/src/github.com-1ecc6299db9ec823/cfg-if-0.1.9/src/lib.rs:41:40
    |
41  |         if #[cfg($($meta:meta),*)] { $($it:item)* }
    |                                        -------- while parsing argument for this `item` macro fragment

error: aborting due to previous error

error: could not compile `time`.

This is relatively consistent on both a Windows 10 Debian WSL and a Linux laptop, both with Rust 1.44 stable. I say relatively because for some reason the build succeeds somehow sometimes, but no idea why.

qtfkwk avatar Jun 12 '20 12:06 qtfkwk

cargo update seems to resolve the issue... will continue testing and share any additional observations.

qtfkwk avatar Jun 12 '20 12:06 qtfkwk

As noted in https://github.com/time-rs/time/issues/263#issuecomment-643464936 the fix to avoid the immediate need to run cargo update is to update the time crate dependency version to >=0.2.9, although latest is 0.2.16 https://github.com/time-rs/time/blob/master/CHANGELOG.md#0216-2020-05-12

https://github.com/fschutt/printpdf/blob/master/Cargo.toml#L14

-time = { version = "0.2.1", default-features = false, features = ["std"] }
+time = { version = "0.2.9", default-features = false, features = ["std"] }

Have not tested this at all, just passing the summary information.

qtfkwk avatar Jun 13 '20 10:06 qtfkwk