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

Comments

Projects
None yet
3 participants
@leonardo-m
Copy link

leonardo-m commented Oct 2, 2017

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.

@scottmcm

This comment has been minimized.

Copy link
Member

scottmcm commented Oct 5, 2017

This is expected; see #41336 (comment)

@leonardo-m

This comment has been minimized.

Copy link
Author

leonardo-m commented Oct 5, 2017

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.

@leonardo-m leonardo-m closed this Oct 5, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.