-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-inferenceArea: Type inferenceArea: Type inferenceC-bugCategory: This is a bug.Category: This is a bug.T-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.
Description
Code that asks for some type inference:
fn main() {
let n: u32 = 1;
let mut d: u64 = 2;
d = d % n.into();
}
It gives:
error[E0284]: type annotations needed for `u64`
--> ...\test.rs:4:11
|
3 | let mut d: u64 = 2;
| ----- consider giving `d` a type
4 | d = d % n.into();
| ^ cannot infer type for type `u64`
|
= note: cannot satisfy `<u64 as std::ops::Rem<_>>::Output == u64`
The error message "consider giving d
a type" refers to a "d" that is actually typed as u64.
Using rustc 1.44.0-nightly (3360cc3 2020-04-24).
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-inferenceArea: Type inferenceArea: Type inferenceC-bugCategory: This is a bug.Category: This is a bug.T-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.