`time` crate compilation error

   Compiling sea-bae v0.2.0
    Checking tempfile v3.10.1
    Checking polling v3.5.0
    Checking async-io v2.3.1
    Checking http-body v1.0.0
    Checking sha1 v0.10.6
    Checking sqlformat v0.2.3
error[E0282]: type annotations needed for `Box<_>`
  --> /xxxxxxx/.cargo/registry/src/index.crates.io-6f17d22bba15001f/time-0.3.34/src/format_description/parse/mod.rs:83:9
   |
83 |     let items = format_items
   |         ^^^^^
...
86 |     Ok(items.into())
   |              ---- type must be known at this point
   |
help: consider giving `items` an explicit type, where the placeholders `_` are specified
   |
83 |     let items: Box<_> = format_items
   |              ++++++++
   Compiling pin-project-internal v1.1.5
    Checking md-5 v0.10.6
    Checking tokio-util v0.7.11
    Checking regex-syntax v0.6.29
    Checking anstyle-query v1.0.3
    Checking try-lock v0.2.5
    Checking is_terminal_polyfill v1.70.0
    Checking regex-syntax v0.8.3
    Checking async-global-executor v2.4.1
    Checking async-std v1.12.0
    Checking colorchoice v1.0.1
    Checking whoami v1.5.1
For more information about this error, try `rustc --explain E0282`.
error: could not compile `time` (lib) due to 1 previous error

Trying to setup the toolchain for the first time and cargo clippy --all --tests gives me the error above.

>> cargo --version
cargo 1.80.0-nightly (0de7f2ec6 2024-05-17)
// rust-toolchain.toml
[toolchain]
channel = "nightly"
components = ["rustfmt", "clippy"]
// .clippy.toml
cognitive-complexity-threshold = 30

Am I doing anything wrong?

1 Like

I change it to stable and it works. Solved.

Looks like the same issue as this. The fix on nightly is probably a dependency bump to the latest version somewhere.

Someone else reported this and closed it themself. If this is more than a temporary issue on a few nightlies, let me know and I can take a look.

1 Like

Presumably this is Type inference regression on `nightly-2024-05-20` · Issue #125319 · rust-lang/rust · GitHub

cargo update -p time will fix it. If importing time directly then you may want to update your Cargo.toml to use the latest version.

5 Likes

I got this error when I try to build leptos-query GitHub - gaucho-labs/leptos-query: Async state management for Leptos, providing simplified data fetching, integrated reactivity, SSR support, and smart cache management. ,I excuted cargo update -p time to update the cargo.toml. finally it passed

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.