Nightly fails to infer the type of iterator collect & impl IntoIterator, and gives confusing error message #93794
Labels
A-impl-trait
Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.
C-bug
Category: This is a bug.
P-high
High priority
regression-from-stable-to-nightly
Performance or correctness regression from stable to nightly.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Code
I tried this code:
I expected to see this happen: The code compiles (as it does on stable and beta). The compiler could infer the return type from the first return statement (
Vec<()>
), and successfully collect the iterator into it in the second return.Instead, this happened:
The compiler seems to have trouble to infer the type of the second return, and gives confusing messages. Instead of explaining that it cannot infer the type (which can be understandable given some update in the library), it gives some serious complaint that the given type doesn't support this kind of operation.
Version it worked on
It most recently worked on: Stable version: 1.58.1, 1.59.0-beta.6(2022-02-02 0426998)
Version with regression
rustc --version --verbose
:@rustbot modify labels: +regression-from-stable-to-nightly -regression-untriaged
The text was updated successfully, but these errors were encountered: