Repository: sharkdp/bat (language: rust)

Issue:
Cannot compile bat: error[E0282]: type annotations needed for `Box<_>`
I am trying to build bat, but running into an error.

```
% rustup -V
rustup 1.27.1 (54dd3d00f 2024-04-24)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.80.0 (051478957 2024-07-21)`

% cargo build
   Compiling libc v0.2.149
   Compiling proc-macro2 v1.0.79
   Compiling unicode-ident v1.0.4
   Compiling serde v1.0.199
   Compiling memchr v2.6.4
   Compiling pkg-config v0.3.25
   Compiling regex-syntax v0.8.2
   Compiling hashbrown v0.14.1
   Compiling equivalent v1.0.1
   Compiling strsim v0.10.0
   Compiling fnv v1.0.7
   Compiling rustix v0.38.21
   Compiling ident_case v1.0.1
   Compiling bitflags v2.4.0
   Compiling cfg-if v1.0.0
   Compiling utf8parse v0.2.1
   Compiling colorchoice v1.0.0
   Compiling anstyle-parse v0.2.0
   Compiling anstyle v1.0.0
   Compiling tinyvec_macros v0.1.0
   Compiling itoa v1.0.3
   Compiling anstyle-query v1.0.0
   Compiling crc32fast v1.3.2
   Compiling tinyvec v1.6.0
   Compiling same-file v1.0.6
   Compiling anstream v0.6.4
   Compiling powerfmt v0.2.0
   Compiling once_cell v1.19.0
   Compiling anyhow v1.0.86
   Compiling aho-corasick v1.1.2
   Compiling clap_lex v0.6.0
   Compiling winnow v0.5.18
   Compiling deranged v0.3.11
   Compiling indexmap v2.2.6
   Compiling walkdir v2.5.0
   Compiling ryu v1.0.11
   Compiling serde_json v1.0.85
   Compiling adler v1.0.2
   Compiling either v1.8.0
   Compiling log v0.4.20
   Compiling num-conv v0.1.0
   Compiling thiserror v1.0.61
   Compiling percent-encoding v2.2.0
   Compiling safemem v0.3.3
   Compiling time-core v0.1.2
   Compiling unicode-bidi v0.3.8
   Compiling line-wrap v0.1.1
   Compiling itertools v0.13.0
   Compiling form_urlencoded v1.1.0
   Compiling miniz_oxide v0.7.1
   Compiling unicode-normalization v0.1.22
   Compiling time v0.3.34
   Compiling quick-xml v0.31.0
   Compiling quote v1.0.35
error[E0282]: type annotations needed for `Box<_>`
  --> /Users/brenton/.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 regex-automata v0.4.3
   Compiling syn v2.0.57
   Compiling idna v0.3.0
   Compiling semver v1.0.23
   Compiling bugreport v0.5.0
   Compiling base64 v0.21.0
   Compiling bytemuck v1.12.1
For more information about this error, try `rustc --explain E0282`.
error: could not compile `time` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
```

If I run `cargo update`, I can then build.

Cannot compile bat: error[E0282]: type annotations needed for `Box<_>`
I am trying to build bat, but running into an error.

```
% rustup -V
rustup 1.27.1 (54dd3d00f 2024-04-24)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.80.0 (051478957 2024-07-21)`

% cargo build
   Compiling libc v0.2.149
   Compiling proc-macro2 v1.0.79
   Compiling unicode-ident v1.0.4
   Compiling serde v1.0.199
   Compiling memchr v2.6.4
   Compiling pkg-config v0.3.25
   Compiling regex-syntax v0.8.2
   Compiling hashbrown v0.14.1
   Compiling equivalent v1.0.1
   Compiling strsim v0.10.0
   Compiling fnv v1.0.7
   Compiling rustix v0.38.21
   Compiling ident_case v1.0.1
   Compiling bitflags v2.4.0
   Compiling cfg-if v1.0.0
   Compiling utf8parse v0.2.1
   Compiling colorchoice v1.0.0
   Compiling anstyle-parse v0.2.0
   Compiling anstyle v1.0.0
   Compiling tinyvec_macros v0.1.0
   Compiling itoa v1.0.3
   Compiling anstyle-query v1.0.0
   Compiling crc32fast v1.3.2
   Compiling tinyvec v1.6.0
   Compiling same-file v1.0.6
   Compiling anstream v0.6.4
   Compiling powerfmt v0.2.0
   Compiling once_cell v1.19.0
   Compiling anyhow v1.0.86
   Compiling aho-corasick v1.1.2
   Compiling clap_lex v0.6.0
   Compiling winnow v0.5.18
   Compiling deranged v0.3.11
   Compiling indexmap v2.2.6
   Compiling walkdir v2.5.0
   Compiling ryu v1.0.11
   Compiling serde_json v1.0.85
   Compiling adler v1.0.2
   Compiling either v1.8.0
   Compiling log v0.4.20
   Compiling num-conv v0.1.0
   Compiling thiserror v1.0.61
   Compiling percent-encoding v2.2.0
   Compiling safemem v0.3.3
   Compiling time-core v0.1.2
   Compiling unicode-bidi v0.3.8
   Compiling line-wrap v0.1.1
   Compiling itertools v0.13.0
   Compiling form_urlencoded v1.1.0
   Compiling miniz_oxide v0.7.1
   Compiling unicode-normalization v0.1.22
   Compiling time v0.3.34
   Compiling quick-xml v0.31.0
   Compiling quote v1.0.35
error[E0282]: type annotations needed for `Box<_>`
  --> /Users/brenton/.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 regex-automata v0.4.3
   Compiling syn v2.0.57
   Compiling idna v0.3.0
   Compiling semver v1.0.23
   Compiling bugreport v0.5.0
   Compiling base64 v0.21.0
   Compiling bytemuck v1.12.1
For more information about this error, try `rustc --explain E0282`.
error: could not compile `time` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
```

If I run `cargo update`, I can then build.



Discussion / hints:

Fix patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8bb7a57914..27a2d806ce 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -16,6 +16,7 @@
 - Fix handling of inputs with OSC ANSI escape sequences, see #2541 and #2544 (@eth-p)
 - Fix handling of inputs with combined ANSI color and attribute sequences, see #2185 and #2856 (@eth-p)
 - Fix panel width when line 10000 wraps, see #2854 (@eth-p)
+- Fix compile issue of `time` dependency caused by standard library regression #3045 (@cyqsimon)
 
 ## Other
 
diff --git a/Cargo.lock b/Cargo.lock
index 5fc3e1fdf1..c49ff655b1 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1347,9 +1347,9 @@ dependencies = [
 
 [[package]]
 name = "time"
-version = "0.3.34"
+version = "0.3.36"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749"
+checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885"
 dependencies = [
  "deranged",
  "itoa",
@@ -1368,9 +1368,9 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3"
 
 [[package]]
 name = "time-macros"
-version = "0.2.17"
+version = "0.2.18"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774"
+checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf"
 dependencies = [
  "num-conv",
  "time-core",


Test patch: