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

Some missing type inference in last nightly #44973

Closed
leonardo-m opened this issue Oct 2, 2017 · 2 comments
Closed

Some missing type inference in last nightly #44973

leonardo-m opened this issue Oct 2, 2017 · 2 comments
Labels
A-inference Area: Type inference 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.

Comments

@leonardo-m
Copy link

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.

@TimNN TimNN added A-inference Area: Type inference 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. labels Oct 3, 2017
@scottmcm
Copy link
Member

scottmcm commented Oct 5, 2017

This is expected; see #41336 (comment)

@leonardo-m
Copy link
Author

OK, then this issue should be closed down... This could be the biggest breakage of my codebase since Rust V. 1.0 :-) I have had to fix about 1 problem every about 800 lines of my codebase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-inference Area: Type inference 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.
Projects
None yet
Development

No branches or pull requests

3 participants