Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression in type annotations needed for check between 1.79 and 1.80 #128242

Closed
Fishrock123 opened this issue Jul 26, 2024 · 2 comments
Closed
Labels
C-discussion Category: Discussion or questions that doesn't represent real issues. regression-from-stable-to-stable Performance or correctness regression from one stable version to another.

Comments

@Fishrock123
Copy link
Contributor

Fishrock123 commented Jul 26, 2024

Code

I tried this code:

[package]
name = "example"
version = "0.1.0"
edition = "2021"

[dependencies]
time = { version = "=0.3.34", features = ["formatting"] }
cargo check

Code in question for this version: https://github.com/time-rs/time/blob/f11f9b2a0c8d17badd96a8a9167d81466a3fa39b/time/src/format_description/parse/mod.rs#L66-L87

This existing source code should continue to work fine between Rust 1.79 and 1.80.

Instead, this happened:

error[E0282]: type annotations needed for `Box<_>`
  --> /Users/jsenkpiel/.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
   |              ++++++++

Version it worked on

It most recently worked on: 1.79

Version with regression

rustc --version --verbose:

rustc 1.80.0 (051478957 2024-07-21)
binary: rustc
commit-hash: 051478957371ee0084a7c0913941d2a8c4757bb9
commit-date: 2024-07-21
host: aarch64-apple-darwin
release: 1.80.0
LLVM version: 18.1.7

I think the issue was fixed by this change in time for 0.3.35. However, it should still not fail between regular Rustc version upgrades.

Apparent fix in time @ 0.3.35: time-rs/time@5b0c627 - time-rs/time#671

@Fishrock123 Fishrock123 added C-bug Category: This is a bug. regression-untriaged Untriaged performance or correctness regression. labels Jul 26, 2024
@rustbot rustbot added I-prioritize Issue: Indicates that prioritization has been requested for this issue. needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. regression-from-stable-to-stable Performance or correctness regression from one stable version to another. and removed regression-untriaged Untriaged performance or correctness regression. labels Jul 26, 2024
@lqd
Copy link
Member

lqd commented Jul 26, 2024

See #127343 and #127343 (comment)

@tgross35
Copy link
Contributor

To add some context: type inference is one of the few behaviors that is not covered by Rust's stability guarantees, partially because adding new library items can break it. Obviously no regressions is always the goal, but it does mean that sometimes we accept inference regressions for things that objectively make Rust better - like here.

Being able to specify the type means that there is always a fix that works for all rust versions. Also, time has already accounted for this - just needs an update.

@tgross35 tgross35 closed this as not planned Won't fix, can't repro, duplicate, stale Jul 26, 2024
@tgross35 tgross35 added C-discussion Category: Discussion or questions that doesn't represent real issues. and removed C-bug Category: This is a bug. I-prioritize Issue: Indicates that prioritization has been requested for this issue. needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jul 26, 2024
stphnt added a commit to stphnt/zproto that referenced this issue Aug 2, 2024
Rust 1.80 broke type inferencing for older versions of the time crate,
which the previously used version of the time simple_logger crate
depended upon. See rust-lang/rust#128242 for
more details.

This change bumps the dependency, allowing tests and examples to compile
properly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-discussion Category: Discussion or questions that doesn't represent real issues. regression-from-stable-to-stable Performance or correctness regression from one stable version to another.
Projects
None yet
Development

No branches or pull requests

4 participants