-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Nightly fails to infer the type of iterator collect & impl IntoIterator, and gives confusing error message #93794
Copy link
Copy link
Closed
Labels
A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.C-bugCategory: This is a bug.Category: This is a bug.P-highHigh priorityHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.Performance or correctness regression from stable to nightly.
Metadata
Metadata
Assignees
Labels
A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.C-bugCategory: This is a bug.Category: This is a bug.P-highHigh priorityHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.Performance or correctness regression from stable to nightly.
Type
Fields
Give feedbackNo fields configured for issues without a type.
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