-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-inferenceArea: Type inferenceArea: Type inferenceT-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.
Description
The latest Nightly (rustc 1.22.0-nightly f1b5225 2017-10-01, Gnu64) doesn't perform type inference in many cases, an example:
fn foo(mut n: u32, k: u32) -> u64 {
let mut res: u64 = 1;
for i in 0 .. k {
res *= n.into();
n -= 1;
res /= i.into();
}
res % 1000
}
fn main() {}
Gives:
error[E0283]: type annotations required: cannot resolve `u64: std::ops::MulAssign<_>`
--> ...\test.rs:4:13
|
4 | res *= n.into();
| ^^
I have seen several other cases of missed type inference in this Nightly, with sum() and product() in code that compiles every day since months.
The Beta and the Nightly of one or two days before doesn't show this problem.
Metadata
Metadata
Assignees
Labels
A-inferenceArea: Type inferenceArea: Type inferenceT-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.