Skip to content

Type inference regression on nightly-2024-05-20 #125319

Closed
neondatabase/neon
#8142
@oblique

Description

@oblique

Code

I tried this code:

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

[dependencies]
time = { version = "=0.3.34", features = ["parsing"] }
fn main() {}

I expected to see this happen: Compile successfully.

Instead, this happened: Compilation failed with the following.

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

For more information about this error, try `rustc --explain E0282`.
error: could not compile `time` (lib) due to 1 previous error

Version it worked on

It most recently worked on:

rustc --version --verbose:

rustc 1.80.0-nightly (b1ec1bd65 2024-05-18)
binary: rustc
commit-hash: b1ec1bd65f89c1375d2cf2fb733a87ef390276d3
commit-date: 2024-05-18
host: x86_64-unknown-linux-gnu
release: 1.80.0-nightly
LLVM version: 18.1.4

Version with regression

rustc --version --verbose:

rustc 1.80.0-nightly (d84b90375 2024-05-19)
binary: rustc
commit-hash: d84b9037541f45dc2c52a41d723265af211c0497
commit-date: 2024-05-19
host: x86_64-unknown-linux-gnu
release: 1.80.0-nightly
LLVM version: 18.1.4

@rustbot modify labels: +regression-from-stable-to-nightly-regression-untriaged

Activity

added
C-bugCategory: This is a bug.
regression-untriagedUntriaged performance or correctness regression.
on May 20, 2024
added
I-prioritizeIssue: Indicates that prioritization has been requested for this issue.
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on May 20, 2024
lukas-code

lukas-code commented on May 20, 2024

@lukas-code
Member

Regression in #99969.

This code used to infer _ as [char], but now it is ambiguous between [char] and str. (playground)

fn main() {
    let _: Box<_> = ['a'].into_iter().collect();
}

@rustbot modify labels: +regression-from-stable-to-nightly -regression-untriaged T-libs-api

added
T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.
and removed
regression-untriagedUntriaged performance or correctness regression.
on May 20, 2024
kpreid

kpreid commented on May 20, 2024

@kpreid
Contributor

Per #99969 (comment) this is a known breakage, which can be addressed by updating your project's time dependency to version 0.3.36 or later.

oblique

oblique commented on May 20, 2024

@oblique
Author

Does this mean it will be enabled by 2024 edition?

added a commit that references this issue on May 21, 2024

64 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-inferenceArea: Type inferenceC-bugCategory: This is a bug.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @oblique@kpreid@dtolnay@apiraino@lukas-code

      Issue actions

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